optimize_battery

Last updated:

0 purchases

optimize_battery Image
optimize_battery Images
Add to Cart

Description:

optimize battery

optimize_battery #
Check for application battery optimization status and open settings or disable it
Getting Started #
Check if app is ignoring battery optimization #
OptimizeBattery.isIgnoringBatteryOptimizations().then((onValue) {
setState(() {
if (onValue) {
// Igonring Battery Optimization
} else {
// App is under battery optimization
}
});
});
copied to clipboard
Take user to battery optimization settings #
OptimizeBattery.openBatteryOptimizationSettings()
copied to clipboard
Show battery optimization disable dialog #
OptimizeBattery.stopOptimizingBatteryUsage();
copied to clipboard
This opens the battery optimization disable dialog.

Add the permission in Mainfest file
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
copied to clipboard
It uses the intent(ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS). Which is not recommended unless its an excemtion case. Such as the applications main functionality needs the battery optimisation to be disabled.
Read more here : https://developer.android.com/training/monitoring-device-state/doze-standby#exemption-cases
Credit #
This plugin is inspired from battery_optimization but with supporting Null safety and Android V2 embedding

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.