![](/img/trans.png)
[英]how to get direction to the shortest path outside circle in google maps android, when my current location is inside 2 or more circles?
[英]How to get direction navigation in Google maps in android
我想在點擊信息窗口時顯示導航方向。
我嘗試了一些代碼,它顯示了預覽按鈕,但它沒有顯示導航按鈕。
我得到的如下圖所示:
但是,我想這樣:
這是我的代碼:
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?" +
"saddr="+ gps.latitude + "," + gps.longitude + "&daddr=" + marker.getPosition().latitude + "," +
marker.getPosition().longitude+ "&sensor=false&units=metric&mode=driving"));
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
startActivity(intent);
您可以按照此文檔了解如何使用指向地址或坐標的轉彎路線啟動Google地圖導航。
這是一個示例Intent,它要求在澳大利亞悉尼的Taronga動物園進行逐向導航:
Uri gmmIntentUri = Uri.parse("google.navigation:q=Taronga+Zoo,+Sydney+Australia");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
檢查這些相關的SO線程:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.