Excessive WakeUps warned by Android Vitals for Google Play Services geofences
Asked Answered
U

2

21

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] The documentation for geofences on android can be seen here: https://developer.android.com/training/location/geofencing.html

[Edit 2] There is an issue on the Android tracker that is discussing this situation, but no new updates on that front either

[Edit 3]: The issue was assigned on the Google Issue tracker. on ~22/08/2018

Thanks for your attention,

Unionist answered 23/2, 2018 at 21:34 Comment(6)
It depends on what your goal for your app. Android vitals is created as an initiative to improve the stability and performance of Android devices. The data collected will help you improve the stability and performance of your app. This will help you maximize the battery of the phone when your app is in use. It may need some adjustment based from the data that you received. Hope this helps.Carrelli
Thanks for your answer! But my problem is that even using basic geofences, accordingly with the best practices that Google advices, are making the numbers above what Android Vitals requires. What's even worse is that all of Google's apps (Such as Google Maps) are way above the number of Wake Ups (reaching 14 wake ups per hour when the Limit is 10. In my scenario I was just warning the user when he leaves home to execute an action that he defined (for example). I think either the policy for Android Vitals need to be reevaluated or Android geofencing services must be updated. :(Unionist
@GabrielFalcone did you find any solution to that issue?Graft
@Graft Not a satisfactory one. I ended resorting to my own validations and a larger geofence (500m) . It made my application wake up 'more' but the counter of alarms have been reduced overall (from 15 to ~6 in worst case scenario), still better than triggering it.Unionist
I see somebody created a bugreport for Android with the same issue. However, that ticket still has the New status, without any response. The ticket is here: issuetracker.google.com/issues/78591747 Curious if somebody found a better workaround.Landwehr
Yeah, I was aware of that issue, but no updates up to this point. I will also include on the main post, thanks for the information! @LandwehrUnionist
U
0

Apparently this topic on Google's issue tracker was marked as fixed. I have yet to verify it though.

Unionist answered 18/7, 2019 at 13:7 Comment(0)
J
-1

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);
Jook answered 30/3, 2018 at 10:22 Comment(1)
I am afraid it's not an option as I'm not requesting location, only geofences, and thus there is not fastest interval nor priority. The documentation for geofences is here: developer.android.com/training/location/geofencing.html . I used all available parameters for reduction such as reducing the responsivenessDelay, but none were satisfactory. :(Unionist

© 2022 - 2024 — McMap. All rights reserved.