Similarly, other OS primitives like alarms, network, and FCM messages also have constraints that are described in the developer documentation on power-management restrictions. Use foreground services but provide an action in the notification so user can stop the foreground service.Make any work/task that is done in the background deferrable.Do the needed work when the user is actively using the app.We recommend the following strategy given the importance for app developers to invest in the right design patterns and architecture: The diagram below helps understand when a scheduled work will run.Īs you update your apps to target Oreo or above, please review this checklist and follow the below table for background workįoreground Service with action to STOP service Please test your app with these features enabled on a device running Android 9 Pie.īattery Saver and Doze operate on a device-wide level, while Adaptive Battery ( app standby buckets powered by a Deepmind ML model) and background restrictions operate on a per-app basis. To address these needs, we have introduced App Standby Buckets, Background Restrictions, and improved Battery Saver. This means that the OS needs to be smarter and adapt to user preferences while improving the battery life of the device. Users don't want to be bothered to configure app settings.In Android 9 Pie, we made further improvements based on these three principles: Background limits in Android 8.0 Oreo, which prevent background services and throttle location updates.Doze improvements in Android 7.0 Nougat, which applies a subset of Doze restrictions when the screen is off and not stationary.
When you update your app's target API level, it's important that you evaluate your background and foreground needs, which could have a significant impact on power & performance. Keeping the target API level current will ensure that apps can take advantage of security and performance enhancements offered in the latest platform releases. Being a good steward of battery power is an important part of your relationship with the user, and we're continuing to add features to the platform that can help you accomplish this.Īs part of our announced Play policy about improving app security and performance, an app's target API level must be no more than one year older than the current Android release. Your users care a lot about battery - if it runs out too quickly, it means they can't use your apps. This is the first in a series of blog posts that outline strategies and guidance in Android with regard to power. Posted by Madan Ankapura, Product Manager, Android