Android:启动 Google 地图应用程序
我在另一篇 Stack Overflow 帖子中看到,您可以通过将两个地址作为 URL 中的参数传递来从应用程序中打开 Google 地图应用程序。
String url = "http://maps.google.com/maps?saddr=some+address&daddr=another+Address"
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
如何从应用程序启动 Google 地图应用程序并获取从当前位置到某个地址的路线?
I saw in another Stack Overflow post you can open the Google maps application from your application by passing two address as parameters in the URL.
String url = "http://maps.google.com/maps?saddr=some+address&daddr=another+Address"
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url));
How can you start the Google maps application from your app and get directions from your current location to an address?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然可以,但您必须首先通过 GPS 坐标获取您的位置。或者,只需设置第二个位置的位置,然后让用户点击它并使用地图本身查找从当前位置出发的方向。
Absolutely, but you'll have to grab your location via GPS coordinates first. Or, just set the position of the second location and let the user tap it and find directions from their current position using Maps itself.