I want know if it's possible to launch the Google n开发者_运维问答avigation to a specific location by providing GPS coordinates of that location from an application.
If you mean you want to launch google turn by turn navigation from your application by providing latitude & longitude coordinates, then here is the code:
public void launchNavigation(){
String location = mLat + "," + mLng;
Uri gmmIntentUri = Uri.parse("google.navigation:q="+location);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
Basically in the Uri parameter you can pass either street address or Lat,Lng like the following:
google.navigation:q=a+street+address
google.navigation:q=latitude,longitude
I hope this could help someone with the same problem as I guess your problem would have been resolved long ago.
精彩评论