• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using LocationManager and locationListener

 
Dov Ezra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm writing an app that finding a route from user location to a selected destination.
The general idea is to pick a destination point on the map and user location from GPS or phone tower
and then call Google routing web service.

The question is how should I get user location?
I can call LocationManager.requestLocationUpdates() and start looking for location updates.
but for how long? all I need is one starting point. nothing more. should I stop the listener at the first time
onLocationUpdate() is called? what is the common practice in this situation?

The second option is calling getLastKnownLocation(). how much can I relay on it?
right now I'm using only android emulator. don't have an acctual device to test this app yet.
I tried to connect to the running emulator using telnet and use geo fix to set locations. but then I noticed that calling getLastKnownLocation will not always return the last fix I entered. I'm probably doing something wrong. can you guide me here?

Thanks,
Dov
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic