I would like to get location of user, so I have this code:
LocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MINIMUM_TIME_BETWEEN_UPDATES,
MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("locationManager ", "locationManager ");
/*
* try to get last know location
*/
Location location = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
public void onLocationChanged(Location location) {
this.location=location;
and than I send geo fix:
geo fix -122.41914 37.77919
it works fine in emulator, but when I try on on real device. it doesn’t work, and I see the GPS icon blinking on device. Notice: GPS is enabled on device.
my question is:
-
Do I need to sign application first, or put it on Google Play in order for app to work on device. Because I just sent the app to device by email.
-
do you have a link of working example of location service so that I could install and test on device to see if it’s behave differently.
I think the problem is that your device can take a very long time to get a GPS fix. You may have to wait a few minutes (the blinking GPS icon means that the device is trying to get a GPS fix).