gpt4 book ai didi

android - 谷歌地图和导航

转载 作者:搜寻专家 更新时间:2023-11-01 08:00:44 26 4
gpt4 key购买 nike

谷歌地图和谷歌导航是同一个包吗?

我想在启动此 Intent 之前检查是否安装了 Google Navigation

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
Uri.parse("google.navigation:ll="+toPosition.latitude+","+ toPosition.longitude));
startActivity(intent);

我用这个方法来检查它是否安装

public boolean isGoogleNavInstalled()
{
try
{
ApplicationInfo info = getActivity().getPackageManager().getApplicationInfo("google.navigation", 0 );
return true;
}
catch(PackageManager.NameNotFoundException e)
{
return false;
}
}

但这总是返回 FALSE。谷歌导航包的确切名称是什么?如果它与谷歌地图相同,那么可以假设任何版本的谷歌地图,关于设备和 API 级别,都带有导航吗?

最佳答案

Is Google Maps and Google Navigation the same package?

是的。

I want to check if Google Navigation is installed before launching this intent

与用户更相关的是查看 Intent 是否解析为任何内容,例如通过 PackageManager 上的 resolveActivity()。如果用户希望使用其他应用程序来处理该请求,那是用户的特权。

But this always returns FALSE

那是因为您传递的包名称在您的设备上不存在。

What is tha exact name of the package for google navigation?

Google Navigation 不作为独立包存在。它是 Google map 的一部分。

If its the same as google maps, then it is ok to assume that any version of google maps, regarding the device and API level, comes with navigation ?

我当然不会假设,因为由于本地法律、上游数据提供商的许可条款等原因,导航部分可能存在分发限制。

这就是为什么使用 queryIntentActivities()resolveActivity() 来查看您想要的 Intent 是否解析为某些内容与用户更相关的原因PackageManager 上的 .. 仅仅因为可能想要使用 Google Navigation 并不意味着每个人都想使用 Google Navigation。

请注意,无论如何,您的 Intent 都依赖于未记录的 Uri 结构,因此无法保证即使 Google Maps 也会遵守它。

关于android - 谷歌地图和导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21631872/

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