谷歌地图和导航 [英] Google Maps and Navigation

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

问题描述

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

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

 意向意图=新意图(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级别,自带导航?


解决方案

  

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



  

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


更多有关用户将看到,如果意图解析到任何东西,比如通过 resolveActivity()软件包管理系统。如果用户希望使用其他应用程序来处理该请求,这是用户的prerogative。


  

但是,这始终返回false


这是因为你是路过,它不是你的设备上存在的包名。


  

什么是包谷歌导航?

的塔确切名称

谷歌导航不存在作为一个独立的程序包。这是谷歌地图的一部分。


  

如果它同谷歌地图,那么它是确定假设任何版本的谷歌地图,有关设备和API级别,自带导航?


我当然不会认为,因为有可能是在导航部分分布的局限性,由于当地法律,与上游供应商的数据许可条款等。

这就是为什么它是更为相关的用户给你看,如果你想要意图解析的东西,使用 queryIntentActivities() resolveActivity()软件包管理系统 ..只是因为的的可能要使用谷歌导航,并不意味着的每个人的想使用谷歌导航。

请注意,你的意图无论如何都在一个未公开的乌里结构依靠,所以有没有保证,甚至谷歌地图将履行它。

Is Google Maps and Google Navigation the same package?

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

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

And i use this method to check if its installed

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

But this always returns FALSE. What is the exact name of the package for google navigation? 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 ?

解决方案

Is Google Maps and Google Navigation the same package?

Yes.

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

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.

But this always returns FALSE

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

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

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

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 ?

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.

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

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