我创建了一个按钮,可将用户带到Google地图上的特定位置。这是代码段:
String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
但是,地图只是缩放到特定位置,而没有在我放置的坐标上添加标记。有人可以帮帮我吗?
谢谢。
这对我有用('hellothere'是可以替换或移除的标签):
String uri = String.format(Locale.ENGLISH, "geo:0,0?q=%f,%f(hellothere)",latitude,longitude);
更新:提供位置查询时,geo:参数可以为0,0。
(测试时,您可能需要关闭每个测试的Map应用程序,尤其是如果不移动标记时。)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句