requestIgnoreBatteryOptimizations method
Prompts the user with the system "ignore battery optimizations" dialog.
Call this (e.g. right after startForegroundService) on devices where
the foreground service keeps getting killed and restarted. Returns
true if the app was already exempt (no dialog shown); returns false
when the dialog was launched — re-check with
isIgnoringBatteryOptimizations afterwards since the user's choice
isn't returned directly.
Implementation
Future<bool> requestIgnoreBatteryOptimizations() =>
_platform.requestIgnoreBatteryOptimizations();