Android 13 will monitor high app background battery usage and alert users
On Android 13, Google just released the Developer Preview 2 build. A first Beta build is expected in April, followed by several more betas and a final release in August, September, or October. Google has not set a debut date. The developer resource “Battery Resource Utilization” was updated soon after DP2 dropped.
It covers new “restricted” App regulations and restrictions. What’s more, it mentions a new excessive background battery usage notification. To end the document:
Android 13 introduces a system notification that appears when your app consumes a large amount of device battery during a 24-hour period. This new notification appears for all apps on devices that run on Android 13, regardless of target SDK version.
When measuring your app’s impact on a device’s battery life, the system takes into account the work that your app does in several different places, including the following:
- Foreground services, even those that have visible notifications
- Work tasks, including expedited work
- Broadcast receivers
- Background services
- Your app’s cache
If this notification appears for your app, it won’t appear again on the same device until at least 24 hours later.
If the system detects that your app runs a foreground service for a long period of time—at least 20 hours within a 24-hour window—it sends a notification to the user, inviting them to interact with the Foreground Services (FGS) Task Manager.
Note: If the system shows this notification for your app, it doesn’t show a similar notification again until at least 30 days later.
Android 13 now monitors more parts of an app’s background activities than previous versions (admittedly, this is simplified). In addition, some of its front-end aspects, such services. This is a service that performs actions that require the user’s attention and generates a notification that can’t be dismissed until the service quits or is withdrawn from the foreground. Fitness monitoring apps actively collecting data while “in a workout” or a multimedia player that plays with a foreground service and shows the current song and multimedia controls in a notification are two examples.
It’s easy to imagine numerous respectable apps behaving in this way without giving you a battery alert. A number of exceptions exist in Android 13. Notifications for foreground services of type FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK or FOREGROUND_SERVICE_TYPE_LOCATION are not shown for the two examples given above, therefore they are covered as well. This includes all battery-saving techniques released in Android 13 except for the following:
System apps and system-bound apps
Companion device apps
Apps running on a device in Demo Mode
Device owner apps
Profile owner apps
Apps that have the ROLE_DIALER role
Apps that the user has explicitly designated to provide “unrestricted” functionality in system settings
Most Android ROMs and apps already provide some amount of background battery monitoring, albeit not as comprehensively as this one. You may also recall that Google implemented background battery warnings in Android 8 Oreo. Notifications can be annoying without sensible constraints like presenting only one every 24 hours, because the monitoring logic for such is considerably simpler.
Due to the fact that it is part of Google’s AOSP core, we can expect to see this new battery monitoring feature on pretty much every future Android 13 phone. Overall, we’re hoping this shift benefits all of our batteries.