user1122549
user1122549

Reputation: 748

Mapbox API Directions response parsing for Android

I use Mapbox in my Android app and need to show directions from point A to point B on the map.

I am aware of the Directions API provided by Mapbox. But i can't use it in my app since including 'com.mapbox.mapboxsdk:mapbox-android-directions:1.0.0@aar' it in the gradle file conflicts with another dependency in my app (Different versions of retrofit).

So i am forced to use the API approach. I make a url GET request such as -

https://api.mapbox.com/directions/v5/mapbox/driving/-23.989%2C40.733%3B-74%2C40.733.json?access_token=ACCESSTOKENsteps=true&overview=false&geometries=polyline

However, parsing the json response and plotting the route is difficult. Is there a better way to accomplish this?

Thanks!

Upvotes: 0

Views: 782

Answers (1)

cammace
cammace

Reputation: 3168

mapbox-android-directions has now been deprecated. Use Mapbox Android Services instead. You can also use the latest Mapbox Android SDK beta.3 which includes this library as a dependency. Once included, you can use this example to get directions.

Upvotes: 0

Related Questions