File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes Using LocationManager and locationListener Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Android
Reply Bookmark "Using LocationManager and locationListener" Watch "Using LocationManager and locationListener" New topic
Author

Using LocationManager and locationListener

Dov Ezra
Greenhorn

Joined: Nov 23, 2010
Posts: 21
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
 
 
subject: Using LocationManager and locationListener
 
Threads others viewed
JBuilder Problem
Confusion with Requirement on UI
SWT question
How to construct 'String criteria' ? Help!!!
Specifying my MDB's destination to a message destination reference instead of a JNDI queue
IntelliJ Java IDE