I am developing an location aware application that needs to know the users location. The problem is that the application doesn't seem to work properly.
By properly I mean that every time I have to first open an application (like cardio trainer) in order to get a GPS signal and then run my program, otherwise the GPS icon on the notification bar is blinking like it blinks when the device tries to get GPS signal and after a while it stops and no location is returned!
This is really weird because it shouldn't stop, is there an interval that android provides the GPS to get signal?
On the documentation I haven't found anything about that.
My code is as follows:
lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 10, locationListenerGps);
LocationListener locationListenerGps = new LocationListener() {
public void onLocationChanged(Location location) {
locationResult.gotLocation(location);
Log.e("##################","MyLocation got GPS location accuracy:
"+location.getAccuracy()+" Altitute: "+location.getAltitude()+" log:
"+location.getLongitude()+" lat: "+location.getLatitude());
}
public void onProviderDisabled(String provider) {}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle extras) {}
};
That should open the GPS provider and register a listener called locationListenerGps that would be called by the location manager every 1 minute or 10 meters right?
why I have to open cardioTrainer first to get a GPS signal?