在Android Google Maps API V2中使用非废弃方法进行步行或驾车追踪路线

4

我想完成这个任务,找到了一些库可以做到这一点 这里是由tyczj提供的这里是由akexorcist提供的。这些都是不错的解决方案,但这些库使用的httpClient已经被弃用了,是否有其他的库可以使用呢?谢谢。

这可能会有用。


akexorcist 对我很有效。 - Wilmer
1个回答

3
  1. Make your own http request to get directions information from The Google Directions API and get overview_polyline string from response.
  2. Decode the string using android-maps-utils library with PolyUtil.decode method.

  3. Add decoded points to map:

    List<LatLng> decodedPoints = PolyUtil.decode(polylineString);
    PolylineOptions options = new PolylineOptions();
    options.width(6);
    options.color(Color.RED);
    options.addAll(decodedPoints);
    
    map.addPolyline(options);
    

我一直在阅读文档,但我不知道如何将这个方向 API 的新 API 密钥放入其中,因为我已经有了地图的 API 密钥。 - Rene Limon

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接