Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetching gps coordinates: continuously vs. single request

I have implemented a LocationListener activity to get the lat/lon coordinates. I launch a MapActivity and want to get the current location and show it on the map. Now I'm confused. What is the best approach to show a progress dialog while fetching the coordinates?

  • Start an activity for result (LocationListener) and show a progress dialog while waiting for the coordinates to be delivered.
  • Implement a getCoordinates() method in the LocationListener activity and just call it once i need it (in a thread?)
  • Include LocationListener into MapActivity and let it continuously update field vars from onLocationChanged()

Is there any better solution? I'm pretty sure there is, actually i don't really know what I'm doing right now... :-/

like image 541
iDroid Avatar asked Mar 21 '26 20:03

iDroid


1 Answers

A good model for displaying location(s) on a map can be found on the android official guide. Check this, and scroll down to "Helping the user decide on where to go".

like image 130
Gallal Avatar answered Mar 24 '26 09:03

Gallal



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!