我正在开发 android 应用程序来获取两个位置之间的方向,如下所示
Intent intent = new Intent(android.content.Intent.ACTION_VIEW;
Uri.parse("http://maps.google.com/maps?saddr=12.84281852,80.22529753&daddr=13.00355419,80.200881958"));
startActivity(intent);
运行这个应用程序,它提示我在 1) 浏览器 2) map 中选择一个 如何在编码中默认在map中打开??
最佳答案
我想如果你调用setPackage()
使用 'com.google.android.apps.maps'
它应该启动 Google map 。
这对我来说效果很好:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
intent.setPackage("com.google.android.apps.maps");
startActivity(intent);
关于android - 默认情况下如何在 map View 中启动 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8267281/