Friday, December 9, 2011

how to use android emulator to find the gps location.

Usually from your emulator you can't get current location when you run your GPS location finder application. 
First you have to make sure  this line of code is available in your source code.
// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
You can also request location updates from both the GPS and the Network Location Provider by calling requestLocationUpdates() twice—once for NETWORK_PROVIDER and once for GPS_PROVIDER. But when you run the applicatin in emulator, you should use GPS provider to obtain your location.
And now you have to move to below location by yourself. And run the ddms.bat file
C:/android sdk/tools/ddms.bat
When you run this bat file you will find an emulator controller tab there. from this tab you can pass locations to emulator by longitude and latitude of your current location.

Here you can find your location's longitude and latitude.

No comments:

Post a Comment