我正在尝试Google Maps
从我的Android
应用程序调用外部应用程序。
Intent mIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr=" + stringLatitude + "," + stringLongitude + "&daddr=" + latitud + "," + longitud+"&dirflg=d"));
startActivity(mIntent);
它适用于Android 2.3.6
。
但不是打开Android 4.2
,我第一次单击执行该代码的按钮时,它Google Maps
已正确打开,但是此处没有任何关于“驾驶”模式的信息。
但是一旦我回到主应用程序,我再次在按钮中单击就可以正常工作。它仅在第一次尝试时失败。
我不明白发生了什么
有什么线索吗?
我正在使用以下代码在Android 4.2上正常工作
Intent i = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://maps.google.com/maps?saddr="+a+","+b+"&daddr="+c+","+d+"&mode=driving"));
i.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(i);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句