isBatteryOptimizationDisabled method

  1. @override
Future<bool> isBatteryOptimizationDisabled()
override

Checks whether battery optimization is disabled for the app.

Returns true if the app is excluded from battery optimization (i.e., the system is ignoring optimizations), and false if the app is still subject to Doze mode and other optimizations.

Only available on Android 6.0+; always returns false on unsupported platforms.

Implementation

@override
Future<bool> isBatteryOptimizationDisabled() async {
  final result = await methodChannel.invokeMethod<bool>(
    'isBatteryOptimizationDisabled',
  );
  return result ?? false;
}