簡體   English   中英

如何使用Intent打開和定向Google Maps?

[英]How to Open and Directing Google Maps using Intent?

我有一個問題要讓Google地圖在打開后自動播放...

示例:我已經輸入了意圖代碼,是的,它將根據我的經度和緯度打開Goog​​le地圖。但是,我仍然需要按一個按鈕來啟動Google Maps來指引我。 意圖打開后如何在沒有用戶按下的情況下如何自動打開Goog​​le Map? 可能嗎 ?

這是我的代碼,

private void turnOnMap()
{
    String labelMap = "Target";
    String geouri = "geo:0,0?q=-6.908572,107.610923(XXI)";
    Intent mapInt = new Intent(Intent.ACTION_VIEW, Uri.parse(geouri));
    startActivity(mapInt);
}

我從這些打開的Google地圖中通過意圖獲取了一些意圖代碼信息,這些意圖是針對androidAndroid中的 特定位置 -如何在android應用中使用特定的位置,縮放級別和標記來啟動Google地圖意圖,以及來自官方android網站https:/的最新uri /developer.android.com/guide/components/intents-common.html#Maps

而且,他們沒有解釋打開后我應該添加什么命令來自動播放Google Maps ...

希望您能幫助我...非常感謝您的時間和信息

String strUri = "http://maps.google.com/maps?q=loc:" + latitude + "," + longitude + " (" + yourLocationName + ")";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(strUri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);

暫無
暫無

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

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