Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Navigation (Android 1.6) intent callback

Tags:

android

gps

I'm using intents to launch Google Navigation:

Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + location)); 
startActivity(i);

location is a string with GPS coordinates.

Google Navigation pops up nicely and plots the route. Can they return some type of callback when the user has reached their destination? Any way of implementing startActivityForResult()?

If not, what would be my best bet? I've been considering running a service in the background that keeps tabs on the location and ending Google Navigation and returning to my app when the GPS registers that it's near the destination (because I know the latitude/longitude).

Thanks folks

like image 409
mattbasta Avatar asked Feb 21 '10 04:02

mattbasta


1 Answers

I wanted to post how I managed to get this to work. I'm not using activity callbacks, but I am starting a service with a LocationManager hanging out in it. When the user gets close to the destination coordinates, I just terminate Google Navigation and start my activity back up.

like image 60
mattbasta Avatar answered Oct 01 '22 18:10

mattbasta