Reputation: 21
The app was added in configuration: Battery and device care -> Battery -> Limits for background usage -> Apps never in automatic rest
The app has a foreground service which calls startForeground(...)
and
then
String packageName = getApplicationContext().getPackageName();
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
powerManager.isIgnoringBatteryOptimizations(packageName);
powerManager.isIgnoringBatteryOptimizations always returns false. Is there any work around?
Aquiring a WakeLock doesn't help.
The device is a Samsung Galaxy S20 with Android 13.
From the manifest:
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
Upvotes: 2
Views: 40