从我的应用程序,我打开默认的谷歌地图应用程序。
String uri = String.format(Locale.ENGLISH,geo:0,0? q =%f,%f(%s), locationList.get(1).getLatitude(),locationList.get(1).getLongitude(),My location); Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse(uri)); Log.i(TAG,Uri is+ uri); this.startActivity(intent);这工作正常。但是,是否有可能传递一个坐标列表并将它们全部绘制出来,以便我可以创建一个路径? 解决方案
字符串destination = locationList.get(1).getLatitude()+, + locationList.get 1).getLongitude(); Uri gmmIntentUri = Uri.parse(google.navigation:q =+ destination +& mode = d); Log.e(TAG,Intent uri:+ gmmIntentUri.toString()); Intent mapIntent = new Intent(Intent.ACTION_VIEW,gmmIntentUri); mapIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mapIntent.setPackage(com.google.android.apps.maps); this.startActivity(mapIntent);
这会以导航模式将地图从当前位置打开到指定的目的地。
您可以查看下面的链接,以指定源和目标之间的航点:$ b $ b developers.google/maps/documentation/urls/android-intents
如果您有任何疑问,请告知我。
From my app i am opening the default google map app. Here is how i am doing it.
String uri = String.format(Locale.ENGLISH, "geo:0,0?q=%f,%f(%s)", locationList.get(1).getLatitude(), locationList.get(1).getLongitude(),"My location"); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); Log.i(TAG, "Uri is "+ uri); this.startActivity(intent);This is working fine. But is it possible to pass a list of coordinates and plot them all so i could create a path?
解决方案Here try this:
String destination = locationList.get(1).getLatitude()+"," +locationList.get(1).getLongitude(); Uri gmmIntentUri = Uri.parse("google.navigation:q="+destination+"&mode=d"); Log.e(TAG,"Intent uri : "+gmmIntentUri.toString()); Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); mapIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mapIntent.setPackage("com.google.android.apps.maps"); this.startActivity(mapIntent);this will open map in navigation mode from your current location to the specified destination.
you can have a look at the below link to specify way points between your source and destination: developers.google/maps/documentation/urls/android-intents developers.google/maps/documentation/urls/guide
Let me know if you have any doubts.
更多推荐
如何将坐标列表传递给默认的Google地图应用程序?
发布评论