Reputation: 63
I'm currently working on a custom ROM (based on Android 7.1.2) and have integrated an email client as a system app. It doesn't support FCM/GCM, so I need to disable battery optimization for the email sync to work reliably.
I would prefer not to ask the user to disable battery optimization (even with a dialog box).
Is there a way to white-list the email client in doze mode automatically since it is a system app?
Upvotes: 2
Views: 1973
Reputation: 46
It's possible to disable battery optimization in AOSP for default apps in frameworks_base project, inside data/etc/platform.xml (example on AOSP and LineageOS).
You have to add entries as follow: <allow-in-power-save package="my-package-name" />
Attention: user will NOT be able do enable battery optimization in settings with this method.
Upvotes: 3