Launch user's custom navigation app

97 views Asked by At

I've seen some URIs to start navigation but i'm not convince with it. I used this URI which starts browser or google maps:

Uri u = Uri.parse("google.navigation:q=" + Uri.encode(o.getLocalization().noZipString()));
Intent in = new Intent(Intent.ACTION_VIEW, u);
getActivity().startActivity(in);

And this which starts google navigation:

Uri u = Uri.parse("http://maps.google.com/maps?daddr=" + Uri.encode(o.getLocalization().noZipString()));
Intent in = new Intent(Intent.ACTION_VIEW, u);
getActivity().startActivity(in);

Both methods works but the question is - will user be able to choose custom navigation if present on his phone or google apps are the only ones that will be launched this way? I'm not really sure, those strings don't look too universal but I'm not able to test it for now. I've seen navigation vendor who is posting his own custom URI scheme on he's site but I'm not going to search for custom URI for every single navigation on the market...

1

There are 1 answers

1
Zadrox On

It strongly depends on the application itself. If the application defines that it can handle implicit intents such as those, Android will provide those as an option in the choose app dialogue.

And, only Android M has the ability to show which links an application can handle in the app settings pane, as far as I know.

See this android developer article on linking to other applications.