0

我想知道我是否可以将我的应用程序与谷歌地图等应用程序链接?例如,如果我创建一个按钮并onClick转到 Google 地图应用程序。那么有没有办法可以onClick将按钮的事件直接指向地图?如果是,我该怎么做?

4

3 回答 3

1

你可以用意图来做,如果你想从你的应用程序中打开谷歌地图,你可以用这个代码来做:

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

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

于 2013-03-19T13:50:46.507 回答
0

您可以使用

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

来自Android 开发者指南

于 2013-03-19T13:47:27.357 回答
0
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
Uri.parse("http://maps.google.com/maps?saddr="+mylocation));
startActivity(intent);
于 2013-03-19T13:47:39.953 回答