• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Using LocationManager and locationListener

Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?

    Bookmark Topic Watch Topic
  • New Topic