如何将GoogleMaps嵌入到移动应用程序中进行实时导航?

How to embed GoogleMaps into mobile application for real-time navigation?

以优步为例。我怎样才能获得实时导航功能?

想法

  1. 从 WayPoints API 获取 latitude/longitude waypoints 的列表:https://developers.google.com/maps/documentation/directions/intro#Waypoints

  2. 使用第 1 步中的坐标绘制折线:https://developers.google.com/maps/documentation/android-api/shapes#code_samples

但是,这实际上是重新实现 GoogleMaps 应用程序。如果用户离开路径等,我将不得不调整多段线。

是否可以只嵌入实时路线?

就我的经验而言,您只能嵌入支持嵌入的产品。我认为 google 地图不会。但是检查一下:how to embed Turn by turn navigation on my google.

您可以选择开源导航软件。复制他们的代码并进行必要的更改以满足您的需要。

将他们的 Activity 变成 Fragments,您可以将这些 Fragments 嵌入到您的视图中。

它不会是最简单的,但比实施功能齐全的导航软件更容易。

您的另一个选择是找到可以嵌入的导航软件。