Battery Optimization on Android
Android manufacturers listed below prefer battery life over proper functionality of your apps. This page explains how to work around it.
Don't Kill My App (no affiliation to Sentiance) keeps track of different manufacturers' practices on battery optimization techniques that severely restrict how your app can run in the background and the potential solutions.
Manufacturers listed below are notorious for their strict requirements for background process restrictions, and without proper user-onboarding, and correct battery-related settings, Sentiance SDK cannot guarantee a consistent output on these devices.
Programmatically Prompting for Battery Optimization Permission
When running the SDK on Android 6 and higher, it is recommended to ask the user to disable battery optimization for your app. This makes sure that SDK detections continue to work properly when the device is in Doze mode. This is particularly important with manufacturers like OnePlus and Nokia (HMD Global) who customize Android to do aggressive battery optimization, keeping the device in Doze mode longer than intended.
Additionally, on Android 9, disabling this will prevent Adaptive Battery from bucketing your app based on usage and restricting background processing, all of which that can impact the detection quality of the SDK.
After explaining to the user about the benefits of disabling battery optimization, call the disableBatteryOptimization()
method of the Sentiance
class. This will trigger a system dialog asking the user to allow disabling battery optimization for your app.
The Sentiance SDK does not define the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
permission required for this feature. You must therefore explicitly add this permission to your app.
Please note that Google Play policies prohibit apps from requesting this permission unless the app's core functionality is affected. For more information about the supported use cases, see here.
Please take advantage of SDK Status updates to react to any incorrect configurations.
Embeddable Projects
(These are not maintained by Sentiance)
Last updated