Google has been hard at work on Android 13, and the Developer Preview 2 build of the OS was just released. According to the current plan, the first Beta build will be released in April, followed by a few more betas and, most likely, a full release in August, September, or October. Google isn’t committed to a certain launch date. Some intriguing modifications were detailed in a developer resource titled “Battery Resource Utilization” shortly after DP2 was released. It covers some new criteria and constraints for the “limited” App Standby Bucket state that an app can enter, but it’s the new excessive background battery usage notification that’s most noteworthy. 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
When your app drains a substantial quantity of device battery over the course of a 24-hour period, Android 13 displays a system notification. This new notification is visible in all apps on Android 13 devices, independent of the target SDK version. When calculating the influence of your app on a device’s battery life, the system considers the work that your app does in a variety of places, including the following:
• Services in the foreground, including those with visible notifications
• Work duties, particularly those that must be completed quickly.
• Receivers for broadcasts
• Support services
• The cache of your app
If a notice for your app occurs, it will not display again on the same device for at least 24 hours. If the system detects that your app is running a foreground service for an extended length of time—at least 20 hours within a 24-hour window—it notifies the user and invites them to use the Foreground Services (FGS) Task Manager.
If the system displays this notification for your app, it will not display another comparable notification for at least 30 days. This can all become a little complicated, but an oversimplified explanation is that Android 13 now monitors a wider range of background behaviour from apps. Not only that, but some of its foreground features, such as foreground services, are also included.
These are services that conduct actions that must be visible to the user and that are accompanied by a notification that cannot be dismissed until the service ends or is withdrawn from the forefront. Fitness monitoring apps that are “in a workout” and actively gathering data, or a multimedia player that plays with music are examples of such activity. Apps are excluded from all battery-saving measures introduced in Android 13 under the following circumstances:
• Companion device apps
• System apps and system-bound apps
• Apps that are in Demo Mode on a device
• Apps for device owners
• Apps for profile owners
• Apps that stay on your phone for a long time
• VPN applications
• Apps with the role ROLE DIALER
• Apps that the user has explicitly chosen in system settings to allow “unrestricted” functionality.
Of course, some third party Android ROMs, as well as other apps and managers, already provide comparable background battery monitoring functionality, albeit not to the same extent. You may recall that Google made a similar push with Android 8 Oreo, which resulted in background battery drain warnings.
However, the monitoring logic for those is far more rudimentary, and the notifications themselves can be much more unpleasant because there are no sensible constraints in place, such as just displaying one notification every 24 hours. Because this new battery monitoring is part of Google’s AOSP core, we can expect to see it on nearly every future smartphone running Android 13 if it passes all of the beta testing and proves to be reliable. Hopefully, this decision will benefit all of our battery packs in the long term.