簡體   English   中英

如何將我的Android應用程序鏈接到另一個內置應用程序(例如Google Maps)?

[英]How do i link my android app to another built in application like google maps?

我想知道我是否可以將我的應用程序與諸如Google Maps之類的應用程序鏈接? 例如,如果我創建一個按鈕並單擊onClick ,則轉到Google Maps應用程序,那么我可以將按鈕的onClick事件直接定向到地圖嗎?

您可以有意圖地執行此操作,如果您想從應用程序中打開Goog​​le地圖,則可以使用以下代碼進行操作:

String uri = "geo:"+ latitude + "," + longitude;
Intent myMapIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(myMapIntent);

您可以在相關的Android文檔中找到一些有用的信息

您可以使用

geo:latitude,longitude
geo:latitude,longitude?z=zoom
geo:0,0?q=my+street+address
geo:0,0?q=business+near+city

Android開發人員指南

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
Uri.parse("http://maps.google.com/maps?saddr="+mylocation));
startActivity(intent);

暫無
暫無

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

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