Skip to content
pubscout

disable_battery_optimization

1.1.2, released a year ago by jvapps.in

Check and disable battery optimizations and auto-start settings on Android devices.

WASM-ready
$ flutter pub add disable_battery_optimization
Source repository

What it does

Allows Flutter apps to check native and manufacturer-specific battery optimizations and auto-start permissions. Displays custom dialogs and guides users to disable these restrictions on devices like Xiaomi, Samsung, Oppo, Huawei, and OnePlus.

AI-written summary of version 1.1.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Your background services or alarms are being killed by aggressive Android battery management
  • You need to guide users through manufacturer-specific settings to keep your app running

Skip it when

  • Your app does not rely on background execution or alarms
  • You only need general device information without modifying power settings

Strengths

  • Supports manufacturer-specific optimizations for vendors like Xiaomi, Samsung, Oppo, and Huawei
  • Provides helper methods to check all battery optimizations at once

Weaknesses

  • Cannot programmatically determine if the user actually changed manufacturer-specific settings
  • Android only plugin

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
0

Requires Android platform setup and appropriate permissions to show battery optimization dialogs.

bool isBatteryOptimizationDisabled = await DisableBatteryOptimization.isBatteryOptimizationDisabled;

Alternatives

Packages that do the same job and could replace disable_battery_optimization.

  • battery_plus

    Use battery_plus if you only need to read general battery state and level rather than modifying power optimization settings.