繁体   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