In my application I have an option to start navigation to selected POI. Basically what I want is to launch a turn-by-turn navigator from my application. The thing is I don't know which (if any) navigator is installed.
So, the question is how to start an intent by showing a list of suitable activities for navigation to the user first, letting him choose which one he would like to use? Also would be nice to find a way to pass extra parameters to selected activity (this sounds like an issue to me, since different navigation apps use different names for their extras, I guess).
In case it's not clear: I'm looking for a way to DISPLAY A LIST OF SUITABLE APPLICATIONS FOR NAVIGATION WITH THE OPTION TO MAKE ONE DEFAULT.
EDIT: Find here the implementation http://datamoil.blogspot.com/2011/04/android-universal-intent-to-start.html
To start an activity, use the method startActivity(intent) . This method is defined on the Context object which Activity extends. The following code demonstrates how you can start another activity via an intent. # Start the activity connect to the # specified class Intent i = new Intent(this, ActivityTwo.
An Activity represents a single screen in an app. You can start a new instance of an Activity by passing an Intent to startActivity() . The Intent describes the activity to start and carries any necessary data.
The navigation host is an empty container where destinations are swapped in and out as a user navigates through your app. A navigation host must derive from NavHost . The Navigation component's default NavHost implementation, NavHostFragment , handles swapping fragment destinations.
The bad news is, there isn't a standard Intent URI for navigation.
Yes, google.navigation URIs exist, and an app may choose to support it.
The best solution I can think of is to:
You can enumerate the possible implicit targets using PackageManage.queryIntentActivities
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With