Android - Launching Google Navigation from an app

2020-05-30 07:20发布

问题:

I am currently in progress of an android app, which takes some coordinates by the user (Starting point from gps and destination defined by the user)

I would like my app to launch the google navigation so that it can guide the user through these points. At a next step, I would like to give navigation more points (eg some points of interest) so that it will guide the user through a specific route containing all the points.

Is that possible? All that I find is no-documented practices and no examples. Is there anyone who has solved this problem? If not, can someone suggest some other navigation programm?

Thank you in advance, George

回答1:

You can certainly guide them to a single point:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" +mLat+","+mLong));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Not sure about setting way points might be some way to do it, I think the API is undocumented so use at your own risk. You could have your app in the background listening to the GPS information and have it prompt the user at certain points.