Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start Android navigation for result

I am creating an app where I need to start the navigation app and then use the result (most importantly the driven distance). I am starting the navigation activity with startActivityForResult and using the scheme "google.navigation". Like this:

Intent i = new Intent(
    Intent.ACTION_VIEW,
    Uri.parse("google.navigation:q=Somewhere"));
startActivityForResult(i,1);

This works great, I get a callback when the activity is done, but the data portion of the activity is empty.

Is there a way to do this?

Is there a navigation history where I can browse the latest trip for data?

Best Regards Jakob Simon-Gaarde

like image 674
Jakob Simon-Gaarde Avatar asked Apr 11 '26 23:04

Jakob Simon-Gaarde


1 Answers

Is there a way to do this?

No, there is no way for you to force an activity to give you a result. The determination of whether an activity supports a result lies in the authors of the activity, not the caller of the activity.

Is there a navigation history where I can browse the latest trip for data?

There is no documented and supported API for the Google Navigation Android app (which includes the google.navigation scheme).

like image 76
CommonsWare Avatar answered Apr 13 '26 12:04

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!