[英]How do i link my android app to another built in application like google maps?
I would like to know if i can link my application with a app like google maps? 我想知道我是否可以将我的应用程序与诸如Google Maps之类的应用程序链接? For example If i create a button and
onClick
I go to Google maps app.So is there a way i can direct the onClick
event of the button directly to the maps?If so how do I do it? 例如,如果我创建一个按钮并单击
onClick
,则转到Google Maps应用程序,那么我可以将按钮的onClick
事件直接定向到地图吗?
You can do it with intents, if you want to open google maps from your app, you can do it with this code: 您可以有意图地执行此操作,如果您想从应用程序中打开Google地图,则可以使用以下代码进行操作:
String uri = "geo:"+ latitude + "," + longitude;
Intent myMapIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(myMapIntent);
You can find some useful info about that in the related Android Documentation 您可以在相关的Android文档中找到一些有用的信息
You can use 您可以使用
geo:latitude,longitude
geo:latitude,longitude?z=zoom
geo:0,0?q=my+street+address
geo:0,0?q=business+near+city
From the Android Developer guide 从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.