3

I want know if it's possible to launch the Google navigation to a specific location by providing GPS coordinates of that location from an application.

user820688
  • 719
  • 2
  • 13
  • 27

1 Answers1

1

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.