使用intent调用Google地图时禁止选择器对话框

Chi*_*rag 4 android google-maps

我想在不显示"完整操作对话框"的情况下调用谷歌地图意图?

可能吗?这是我的代码.

String uri = "http://maps.google.com/maps?saddr=" + Utils.getLatitude(ShowDetails.this)+","+Utils.getLongitude(ShowDetails.this)+"&daddr="+userLatitude+","+userLongitude;
startActivity(new Intent(android.content.Intent.ACTION_DEFAULT, Uri.parse(uri)));
Run Code Online (Sandbox Code Playgroud)

我不想在调用谷歌地图意图时显示在下面的对话框中.任何帮助表示赞赏.

在此输入图像描述

Chi*_*rag 12

下面的代码帮助我解决了我的问题.

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);
Run Code Online (Sandbox Code Playgroud)


jmc*_*ale 6

使用Google地图URI而不是"http:// [...]"

它是这样的:

String uri = "geo:" + latitude + "," + longitude
Run Code Online (Sandbox Code Playgroud)

查看http://developer.android.com/guide/appendix/g-app-intents.html获取信息.