battery_optimization_helper
0.2.0, released 9 months ago by techlinkmyanmar.com
Detect and request disabling Android battery optimization with OEM auto-start shortcuts.
What it does
A Flutter plugin for Android that checks if battery optimization is enabled, prompts the user to disable it, and opens system settings. It also includes best-effort shortcuts for OEM-specific auto-start and background execution settings.
AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Your app requires reliable background execution on Android devices.
- You need to check battery restriction status or prompt users to ignore battery optimizations.
Skip it when
- You are targeting iOS or non-Android platforms where battery optimization controls do not apply.
- Your app does not perform background work.
Strengths
- Provides typed optimization outcomes for clearer user flows.
- Includes a diagnostics snapshot API for inspecting device manufacturer and power save state.
- Covers multiple OEM background and auto-start settings paths.
Weaknesses
- OEM auto-start settings paths differ by device and may fail or return false depending on the hardware.
- Android-only functionality.
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Declares REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission by default, which can be modified via manifest merge rules if needed.
import 'package:battery_optimization_helper/battery_optimization_helper.dart';
Future<void> example() async {
final outcome = await BatteryOptimizationHelper.ensureOptimizationDisabledDetailed(
openSettingsIfDirectRequestNotPossible: true,
);
final snapshot = await BatteryOptimizationHelper.getBatteryRestrictionSnapshot();
}Alternatives
Packages that do the same job and could replace battery_optimization_helper.
- auto_start_flutter
Manage background execution, auto-start, battery optimization, and scheduled tasks on multiple platforms.
79Compare - optimize_battery
Check battery optimization status and open settings or disable it on Android.
42Compare
Works with
Packages commonly used together with battery_optimization_helper: ones it builds on, ones built on it, and its own family.