-1

I want to launch Google Maps from my app with an explicit intent; I dont want to navigate to a point in the map or to show any particular place in the map -- I just want to launch Google Maps.

How can I do this? Whats the Intent for it?

MichelReap
  • 5,630
  • 11
  • 37
  • 99
  • 1
    Possible duplicate of [open google maps through intent for specific location in android](https://stackoverflow.com/questions/22704451/open-google-maps-through-intent-for-specific-location-in-android) – Vinay Rathod Jul 27 '18 at 10:11

2 Answers2

2

Use below code

String uri = "http://maps.google.com/";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);

It will open Google Map application.

Anisuzzaman Babla
  • 6,510
  • 7
  • 36
  • 53
1
 new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Uri gmmIntentUri = Uri.parse("geo:0,0?q=");
                Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
                mapIntent.setPackage("com.google.android.apps.maps");
                startActivity(mapIntent);
            }
        }, 1000);

Use this above code in your button click or any other place you want to implement.

SARATH V
  • 500
  • 1
  • 7
  • 33