I am currently working in a sample app for Android which uses geofencing for location monitoring, and I am finding it difficult to comply with Android Vitals background wakeup limit (https://developer.android.com/topic/performance/vitals/wakeup.html).
I am using Battery Historian to monitor wakeups, and while our own alarms stand at a less than one per hour rate, both com.google.android.location.ALARM_WAKEUP_ACTIVITY_DETECTION and com.google.android.location.ALARM_WAKEUP_LOCATOR trigger at much bigger rates. I experimented setting the geofences responsiveness delay to 5 minutes, and the WAKEUP_LOCATOR alarm was greatly reduced. Nonetheless, the ALARM_WAKEUP_ACTIVITY_DETECTION alarm still is well over the 10/hour limit.
We use geofences with 100m radius and monitor the exit transition, as recommended here. I'm also using a bigger geofence with radius up to 2km to define when I need to reload the geofences, to avoid loading too many geofences at once.
Most recent tests were on Android 7.1 on Galaxy S8, but the scenario is regular on other devices. Does anyone have a similar problem? Google recommends using Geofences, especially in light of Oreo's restrictions on background location requests, so it is weird that a system monitoring tool is accounting for so much wakeups when it's the suggested way to avoid it.
Ps: I have read the Yvette Colomb answer here, And I'm not using Location Updates, only the Geofence services. Should I give up on it?
[Edit] Ps2: The documentation for geofences on android can be seen here: https://developer.android.com/training/location/geofencing.html
Thanks for your attention,androidgoogle-play-servicesgeofencingwakeup
This is an issue with the com.google.android.location.ALARM_WAKEUP_LOCATOR waking up devices every 60 seconds and keeping them awake for up to 15 seconds, causing major battery drainage issues.
For map you have to set more time for updating intervals of location.. in my case i did this Let me know if it works
private long UPDATE_INTERVAL = 5 * 6000; private long FASTEST_INTERVAL = 6000; //Set max update intervel for remove excessive wakeups... mLocationRequest.setInterval(UPDATE_INTERVAL); mLocationRequest.setFastestInterval(FASTEST_INTERVAL); mLocationRequest.setMaxWaitTime(30 * 60000); mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);