Suppressing Google Maps Intent Selection Dialog

后端 未结 3 1214
我寻月下人不归
我寻月下人不归 2020-12-14 04:41

When I use this code

   string url = \"somegooglemapsurl.com\";
   Intent mapLauncherIntent = new Intent(android.content.Intent.ACTION_VIEW,  Uri.parse(url))         


        
3条回答
  •  粉色の甜心
    2020-12-14 05:28

    First of all, I'll just point out that getting rid of that selection dialog is not necessarily a good thing to do. You want to give the user as much choice in how they handle data as possible, that's part of the beauty of the Android ecosystem. That said, it isn't fair to judge without understanding your application, so...

    You can use the geo protocol:

    http://developer.android.com/guide/appendix/g-app-intents.html

    Instead of passing something like maps.google.com/blablabla format your URI like thisgeo:0,0?q=my+street+address.

    Example:

    Intent mapLauncherIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=1111+imaginary+dr"));
    

提交回复
热议问题