Suppress chooser dialog when calling Google map using intent

前端 未结 3 1246
梦如初夏
梦如初夏 2020-12-17 05:11

I want to call google map intent without showing \"Complete Action Dialog\"?

Is it possible? Here is my code.

String uri = \"http://maps.google.com/m         


        
相关标签:
3条回答
  • 2020-12-17 05:27

    Below code helps me to solve my question.

    String uri = "http://maps.google.com/maps?saddr=" + Utils.getLatitude(ShowDetails.this)+","+Utils.getLongitude(ShowDetails.this)+"&daddr="+userLatitude+","+userLongitude;
    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);
    
    0 讨论(0)
  • 2020-12-17 05:27

    Use the Google Maps URI rather than "http://[...] "

    It goes something like this:

    String uri = "geo:" + latitude + "," + longitude
    

    Check out http://developer.android.com/guide/appendix/g-app-intents.html for the info.

    0 讨论(0)
  • 2020-12-17 05:42

    Try ACTION_VIEW instead of ACTION_DEFAULT:

    String uri = "geo:"+ latitude + "," + longitude;
    startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));
    

    check this Android doc Intents List and browse to "Google Maps".

    0 讨论(0)
提交回复
热议问题