本文介绍了谷歌地图和导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是谷歌地图和谷歌导航相同的包?

我要检查启动此之前的意图如果安装了谷歌导航

 意向意图=新意图(android.content.Intent.ACTION_VIEW,
Uri.parse(google.navigation:LL =+ toPosition.latitude +,+ toPosition.longitude));
startActivity(意向);

我用这个方法来检查其安装

 公共布尔isGoogleNavInstalled()
    {
        尝试
        {
            ApplicationInfo信息= getActivity()getPackageManager()getApplicationInfo(google.navigation,0)。。
            返回true;
        }
        赶上(PackageManager.NameNotFoundException E)
        {
            返回false;
        }
    }

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


解决方案

Yes.

More relevant to the user would be to see if the Intent resolves to anything, such as via resolveActivity() on PackageManager. If the user wishes to use some other app to handle that request, that is the user's prerogative.

That's because you are passing a package name that does not exist on your device.

Google Navigation does not exist as an independent package. It is part of Google Maps.

I certainly would not assume that, as there may be distribution limitations on the navigation portion, due to local laws, license terms with upstream data providers, etc.

That's why it is far more relevant to the user for you to see if your desired Intent resolves to something, using queryIntentActivities() or resolveActivity() on PackageManager.. Just because you may want to use Google Navigation does not mean that everyone wants to use Google Navigation.

Note that your Intent is relying upon an undocumented Uri structure anyway, and so there is no assurance that even Google Maps will honor it.

这篇关于谷歌地图和导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 07:14