klifa klifa - 5 months ago 24
Android Question

Google Maps and Navigation

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 ?

Answer

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.

Comments