簡體   English   中英

如何將我的位置添加到Google Maps API

[英]how to add my location to google maps api

如何在Android中添加源地址以使用源地址和目標地址打開Goog​​le地圖?

我嘗試了以下方法:

String map ="https://maps.google.com/maps?saddr=My+Location&daddr="+address;

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(map));
i.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
startActivity(i);

我在地圖應用程序中遇到錯誤,因為“我的位置沒有結果”

我的要求是我想用我當前通過的用戶當前位置和目的地地址打開google maps應用程序。

您可以這樣嘗試:

String uri = String.format(Locale.ENGLISH, "geo:0,0?q=", "ahmedabad");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM