Mapbox-navigation-android Add Waypoints
I search to add waypoints to my journey. https://github.com/mapbox/mapbox-navigation-android/blob/master/app/src/main/java/com/mapbox/services/android/navigation/testapp/activity/W
Solution 1:
You can add waypoints when making a new route request with NavigationRoute
.
In our docs https://www.mapbox.com/android-docs/navigation/overview/, look under section 4. Requesting a route
and you'll find an example of how to do this.
NavigationRoute.Builderbuilder= NavigationRoute.builder()
.accessToken(Mapbox.getAccessToken())
.origin(origin)
.destination(destination);
for (Position waypoint : waypoints) {
builder.addWaypoint(waypoint);
}
builder.build();
Solution 2:
Try this...Using google map
StringBuildersb_latlangdrive=newStringBuilder();
for (inti=0; i < arrayList.size(); i++) {
String split[] = arrayList.get(i).split(",");
sb_latlangdrive.append(split[0] + "," + split[1] + "|");
}
String split[] = arrayList.get(0).split(",");
String split_endlocaiton[] = arrayList.get(arrayList.size() - 1).split(",");
UrigmmIntentUri= Uri.parse("https://www.google.com/maps/dir/?api=1&origin=" + split[0] + "," + split[1] + "&destination=" + split_endlocaiton[0] + "," + split_endlocaiton[1] + "&waypoints=" + sb_latlangdrive.toString() + "&travelmode=driving");
Intentintent=newIntent(Intent.ACTION_VIEW, gmmIntentUri);
intent.setPackage("com.google.android.apps.maps");
try {
startActivity(intent);
} catch (ActivityNotFoundException ex) {
try {
IntentunrestrictedIntent=newIntent(Intent.ACTION_VIEW, gmmIntentUri);
startActivity(unrestrictedIntent);
} catch (ActivityNotFoundException innerEx) {
Toast.makeText(TrackingTesting.this, "Please install a maps application", Toast.LENGTH_LONG).show();
}
}
For reference see doc here
Post a Comment for "Mapbox-navigation-android Add Waypoints"