Implement "Round-Trip" to apk navigation

Hi,

I’m attempting to add the round-trip feature of the Graphhopper API to the example navigation APK. From what i understand the following section of code is from the MapBox API and handles the route generation, however I’m unsure of how to include the round-trip feature:

NavigationRoute.Builder builder = NavigationRoute.builder(this)
        .accessToken("pk." + getString(R.string.gh_key))
        .baseUrl(getString(R.string.base_url))
        .user("gh")
        .alternatives(true)
        .origin(location)
       . builder.destination(p);

Any help would be much appreciated.

Thanks
Alex

The easiest option is probably to do this similarly to how we fetch solutions from the OptimizationAPI. Just read the snapped points from the result and generate a new NavigationRoute through Mapbox with the resulting points. Let us know how it goes, contributions to the example navigation APK are welcome :slight_smile:.

2 Likes

Thanks for the help :slight_smile: Will give it a go