Android 13 will notify users of high app background battery usage using complex monitoring

Google has been hard at work on Android 13, recently releasing Developer Preview 2 of the operating system. According to the current timeline, we can expect to see the first beta in April, followed by a few more betas and probably a full release in August, September, or October. Google does not commit to any launch window. Shortly after DP2 was discontinued, some interesting changes were documented in a dev resource called “Battery Resource Utilization”.

It goes over some new rules and limitations around the “restricted” App Standby Bucket state that an app can end up in, but more interestingly, it details a new excessive battery usage notification back- plan. For quite the document itself:

Android 13 introduces a system notification that appears when your app consumes a large amount of device battery over a 24-hour period. This new notification appears for all apps on devices running on Android 13, regardless of the target SDK version.

When measuring the impact of your app on a device’s battery life, the system takes into account the work your app does in several different places, including:

  • Top-tier services, even those with visible notifications
  • Work tasks, including expedited work
  • Broadcast Receivers
  • Background Services
  • The cache of your application

If this notification appears for your app, it will not appear again on the same device for at least 24 hours later.

If the system detects that your application is running a foreground service for a long time (at least 20 hours in a 24 hour window), it sends a notification to the user, prompting them to interact with the task manager of foreground services (FGS). .

Note: If the system displays this notification for your application, it will not display a similar notification again until at least 30 days later.

This can all get a little technical, but a simplified explanation would be that Android 13 now monitors increasingly varied aspects of an app’s background behavior. Not only that, but also some of its premium elements, like premium services. These are services that perform operations that must be perceptible to the user and that have a notification associated with them that cannot be removed until the service stops or is removed from the foreground. Examples of such behavior are things like fitness tracking apps because they’re “in a workout” and actively collecting data or a media player that’s playing with a foreground service and can display things like current song and media controls in a notification.

As you can imagine, many legitimate apps can behave like this without deserving a battery warning notification. Android 13 has more than a few exemptions from its tracking. The two examples we gave above are actually covered since the notification does not appear for foreground services of type FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK or FOREGROUND_SERVICE_TYPE_LOCATION. Additionally, the following situations exempt apps from all battery conservation measures introduced in Android 13:

  • System apps and system-related apps
  • Companion device apps
  • Applications running on a device in demo mode
  • Device owner apps
  • Profile owner apps
  • Persistent apps
  • VPN Apps
  • Applications with the ROLE_DIALER role
  • Apps that the user has explicitly designated to provide “unlimited” functionality in System Settings

Of course, some third-party Android ROMs and other apps and managers already offer similar background battery monitoring features, but not to the same level of depth. You might also remember that as early as Android 8 Oreo, Google already made a similar push, resulting in battery drain warnings in the background. However, the monitoring logic for these is much more rudimentary, and the notifications themselves can be much more obnoxious without clever limitations, such as showing only one notification per 24 hours.

Provided this new battery monitor passes all beta tests and ends up working well, we can expect it to appear in virtually all future smartphones running Android 13 since it is part of Google’s AOSP core. Hopefully all of our batteries will benefit from this decision in the long run.

spring | Via

About Madeline Powers

Check Also

NCD Care – Mobile app facilitates access to hypertension and diabetes care in Ghana

NCD Care is a mobile application that facilitates access to hypertension and diabetes care in …