If I left application turned on for several hours fused location stops sending updates...
I am creating location request with hight priority , here is code :
LocationRequest = LocationRequest.create()
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setExpirationDuration(TimeUnit.SECONDS.toMillis(LOCATION_TIMEOUT_IN_SECONDS))
.setInterval(LOCATION_UPDATE_INTERVAL);
Here is client and callback :
LocationCallback mLocationCallback = new LocationCallback() {
@Override
public void onLocationAvailability(LocationAvailability locationAvailability) {
super.onLocationAvailability(locationAvailability);
}
@Override
public void onLocationResult(LocationResult locationResult) {
super.onLocationResult(locationResult);
//Update location
}
};
mFusedLocationProviderClient = LocationServices.getFusedLocationProviderClient(this);
mFusedLocationProviderClient.requestLocationUpdates(mLocationRequest, mLocationCallback, null);
LOCATION_TIMEOUT_IN_SECONDS is 5 second, but updates is not always running, I stop and start it manually, when my application needs location. Like it is documented .
Everything works fine if application is running one or two hours, but if I left it open for a long time, it stops working....
I requested location updates from Activity on button click, after 10 seconds, I stop location updates manually... If I left it whole night , this means that Activity is alive whole night... after this, when I request location updates again, it is not coming...
Any solution or idea?