views:

26

answers:

0

i have a widget that needs an approximate location. this is what i'm doing ...

  1. in onUpdate(), get the best provider, set a location listener on it, and return
  2. in location listener's onLocationChanged(), update the remote views based on the location, and unregister the listener

this works, and on the emulator things wait until i send a location with DDMS. i guess that is expected. it seems extreme to get a location lock with a GPS for my simple purposes considering battery life.

in the past i've tried to work with COARSE_LOCATION only, but it seems some people don't enable network location which causes it to fail in that case.

another idea would be to ask for lastKnownLocation(), and only if that fails, register for location changed. i've found that can be wildly off though. for example, if a person had last used a location service hundreds of miles from their current location.

is this the best i can do? or am i missing something?

thanks.