gpt4 book ai didi

android - 如何从我的应用程序中打开标准的 Google Map 应用程序?

转载 作者:IT老高 更新时间:2023-10-28 12:59:11 25 4
gpt4 key购买 nike

一旦用户在我的应用程序中按下按钮,我想打开标准的谷歌地图应用程序并显示特定的位置。我该怎么做? (不使用 com.google.android.maps.MapView)

最佳答案

您应该使用地理 URI 创建一个 Intent 对象:

String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);

如果要指定地址,则应使用另一种形式的地理 URI:geo:0,0?q=address

引用:https://developer.android.com/guide/components/intents-common.html#Maps

关于android - 如何从我的应用程序中打开标准的 Google Map 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6205827/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com