是否可以在没有地图的情况下显示 Google 地图导航?

Is it possible to show the Google Maps Navigation without a map?

我想做一个 android 应用程序来搜索(在 Google 地图或其他地图服务中)两点之间的步行路线并开始导航,而不是显示我想要的地图显示带有方向的大箭头。这能做到吗?

我有 java 经验,但没有 Android 开发经验,目前我正在上 Android 开发课程,我想知道是否可以这样做我必须重新构建我的应用程序或要求。

您实际上想使用 GooglePlacesAPI 而不是 Google 地图: https://developers.google.com/places/

这允许您格式化 HTML 地址,例如: https://maps.googleapis.com/maps/api/directions/json?key=APIKEY&origin=42.2912,-83.7161&destination=42.293932,-83.715527&mode=walking&departure_time=now

然后 return 一个 JSON 字符串,如下所示:

{
   "routes" : [
      {
         "bounds" : {
            "northeast" : {
               "lat" : 42.2939666,
               "lng" : -83.7155274
            },
            "southwest" : {
               "lat" : 42.29159749999999,
               "lng" : -83.7162498
            }
         },
         "copyrights" : "Map data ©2015 Google",
         "legs" : [
            {
               "distance" : {
                  "text" : "0.2 mi",
                  "value" : 322
               },
               "duration" : {
                  "text" : "5 mins",
                  "value" : 290
               },
               "end_address" : "University of Michigan - North Campus, 2086-2180 Hayward Street, Ann Arbor, MI 48109, USA",
               "end_location" : {
                  "lat" : 42.2939666,
                  "lng" : -83.7155274
               },
               "start_address" : "University of Michigan - North Campus, 1230 Murfin Avenue, Ann Arbor, MI 48109, USA",
               "start_location" : {
                  "lat" : 42.29159749999999,
                  "lng" : -83.7162498
               },
               "steps" : [
                  {
                     "distance" : {
                        "text" : "0.1 mi",
                        "value" : 234
                     },
                     "duration" : {
                        "text" : "4 mins",
                        "value" : 217
                     },
                     "end_location" : {
                        "lat" : 42.2935727,
                        "lng" : -83.7158445
                     },
                     "html_instructions" : "Head \u003cb\u003enortheast\u003c/b\u003e",
                     "polyline" : {
                        "points" : "oacaGpy}}N_AqAw@CgAEs@?MDMDs@@eAC"
                     },
                     "start_location" : {
                        "lat" : 42.29159749999999,
                        "lng" : -83.7162498
                     },
                     "travel_mode" : "WALKING"
                  },
                  {
                     "distance" : {
                        "text" : "30 ft",
                        "value" : 9
                     },
                     "duration" : {
                        "text" : "1 min",
                        "value" : 10
                     },
                     "end_location" : {
                        "lat" : 42.2935718,
                        "lng" : -83.7159588
                     },
                     "html_instructions" : "Turn \u003cb\u003eleft\u003c/b\u003e toward \u003cb\u003eHayward St\u003c/b\u003e",
                     "maneuver" : "turn-left",
                     "polyline" : {
                        "points" : "ymcaG~v}}N?V"
                     },
                     "start_location" : {
                        "lat" : 42.2935727,
                        "lng" : -83.7158445
                     },
                     "travel_mode" : "WALKING"
                  },
                  {
                     "distance" : {
                        "text" : "141 ft",
                        "value" : 43
                     },
                     "duration" : {
                        "text" : "1 min",
                        "value" : 38
                     },
                     "end_location" : {
                        "lat" : 42.2939604,
                        "lng" : -83.7159652
                     },
                     "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e toward \u003cb\u003eHayward St\u003c/b\u003e",
                     "maneuver" : "turn-right",
                     "polyline" : {
                        "points" : "ymcaGvw}}NmA@"
                     },
                     "start_location" : {
                        "lat" : 42.2935718,
                        "lng" : -83.7159588
                     },
                     "travel_mode" : "WALKING"
                  },
                  {
                     "distance" : {
                        "text" : "118 ft",
                        "value" : 36
                     },
                     "duration" : {
                        "text" : "1 min",
                        "value" : 25
                     },
                     "end_location" : {
                        "lat" : 42.2939666,
                        "lng" : -83.7155274
                     },
                     "html_instructions" : "Turn \u003cb\u003eright\u003c/b\u003e onto \u003cb\u003eHayward St\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eDestination will be on the right\u003c/div\u003e",
                     "maneuver" : "turn-right",
                     "polyline" : {
                        "points" : "gpcaGxw}}NAgA?O"
                     },
                     "start_location" : {
                        "lat" : 42.2939604,
                        "lng" : -83.7159652
                     },
                     "travel_mode" : "WALKING"
                  }
               ],
               "via_waypoint" : []
            }
         ],
         "overview_polyline" : {
            "points" : "oacaGpy}}N_AqA_CIs@?MDMDs@@eAC?VmA@AgA?O"
         },
         "summary" : "Hayward St",
         "warnings" : [
            "Walking directions are in beta.    Use caution – This route may be missing sidewalks or pedestrian paths."
         ],
         "waypoint_order" : []
      }
   ],
   "status" : "OK"
}

到那时,用它做任何你想做的事(也就是将它与加速度计和 GPS 结合起来)在你的屏幕上做任何自定义图像