使用未弃用的方法在 android google 地图 api v2 中追踪步行或驾驶路线
Trace route walking or driving in android google maps api v2 using not deprecated methods
我想完成这个任务,我找到了一些库来完成这个任务 here by tyczj and here by akexorcist。这些都是很好的解决方案,但这个库使用 httpClient,目前已被弃用,还有其他解决方案吗?谢谢
可能会有用。
- 创建您自己的 http 请求以从 The Google Directions API 获取路线信息并从响应中获取
overview_polyline
字符串。
使用 android-maps-utils 库和 PolyUtil.decode
方法解码字符串。
将解码点添加到地图:
List<LatLng> decodedPoints = PolyUtil.decode(polylineString);
PolylineOptions options = new PolylineOptions();
options.width(6);
options.color(Color.RED);
options.addAll(decodedPoints);
map.addPolyline(options);
我想完成这个任务,我找到了一些库来完成这个任务 here by tyczj and here by akexorcist。这些都是很好的解决方案,但这个库使用 httpClient,目前已被弃用,还有其他解决方案吗?谢谢
可能会有用。
- 创建您自己的 http 请求以从 The Google Directions API 获取路线信息并从响应中获取
overview_polyline
字符串。 使用 android-maps-utils 库和
PolyUtil.decode
方法解码字符串。将解码点添加到地图:
List<LatLng> decodedPoints = PolyUtil.decode(polylineString); PolylineOptions options = new PolylineOptions(); options.width(6); options.color(Color.RED); options.addAll(decodedPoints); map.addPolyline(options);