This question is regarding an Android app I am developing. I am testing on a real phone with Android version 7.
I want the FusedLocationApi to request GPS location at 15 minute intervals.
When the app is in the foreground and the screen is on, the GPS requests happen as expected.
When the app is minimized and the phone is asleep, the updates come as expected for one or two hours, then taper off and stop completely. It appears that small vibrations or simply turning the screen on (with the app still in the background) triggers a GPS update.
// Request frequent location updates.
Intent locationUpdateIntent = new Intent(this, StoreLocationService.class);
locationUpdateIntent.setAction(StoreLocationService.ACTION_LOCATION_UPDATE);
LocationRequest locationRequest = LocationRequest.create();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(15 * 60 * 1000); // 15 minutes
locationRequest.setFastestInterval(15 * 60 * 1000); // 15 minutes
LocationServices.FusedLocationApi.requestLocationUpdates(
mGoogleApiClient, locationRequest,
PendingIntent.getService(this, 0, locationUpdateIntent, 0));
I think this is the just because of DOZE mode, Google introduce DOZE mode which is turn of your background service which is using internet or network, DOZE mode is active when your device will approximately 3 to 5-minute ideal or in standby mode (Means you are turn off screen no any application using internet or network).