如何在由 geo URI Intent 启动的地图中显示标记? [英] How do I show a marker in Maps launched by geo URI Intent?

查看:25
本文介绍了如何在由 geo URI Intent 启动的地图中显示标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我想通过启动带有特定地理坐标的 Google 地图来显示不同的位置(一次一个,由用户输入选择).

I have a application where I want to show different locations (one at the time, picked by user input) by launching Google Maps with their specific geo coordinates.

我目前正在使用这个(当然是真实的纬度和经度值):

I'm currently using this (with real lat. and long. values of course):

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<lat>,<long>?z=17"));
startActivity(intent);

这正是我想要的,只是它不显示指定点的任何指示器或标记.它只以它的位置为中心.

It's quite exactly what I want, except that it doesn't show any indicator or marker for the specified point. It only centers at it's location.

有没有办法在不使用 MapView 的情况下获取标记或其他内容?

Is there some way to get the marker or something else included without using a MapView?

推荐答案

试试这个:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:<lat>,<long>?q=<lat>,<long>(Label+Name)"));
startActivity(intent);

如果您不需要标签,可以省略 (Label+Name),它会根据最近的街道或它认为相关的其他事物随机选择一个.

You can omit (Label+Name) if you don't want a label, and it will choose one randomly based on the nearest street or other thing it thinks relevant.

这篇关于如何在由 geo URI Intent 启动的地图中显示标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆