I have no skills in Java to understand how to implement code starting from the developer documentation.
For example in Android 6, reading here it is possible to do the following:
For example in Android 6, reading here it is possible to do the following:
- An app can check whether it is currently on the exemption whitelist by calling isIgnoringBatteryOptimizations()
- An app can fire the ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS intent to take the user directly to the Battery Optimization, where they can add the app.
- An app holding the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission can trigger a system dialog to let the user add the app to the whitelist directly, without going to settings. The app fires a ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS Intent to trigger the dialog.