I bought a new phone (Lava A44) to test my app on Nougat. It has a feature in Battery settings that does not seem to be explained in Android docs (see screenshot below):
I am using Handler#postDelayed() in my app and it works fine when in foreground and after sometime the app stops getting FCM messages and does not fire the postDelayed unless I turn off "App freezer" and Synchronous wake-up" as shown in the picture.
Somehow these settings are found to be Off by default for WhatsApp and Facebook.
As suggested in other posts, I have tried AlarmManager.setAndAllowWhileIdle(), ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, PowerManager#isIgnoringBatteryOptimizations, but to no avail. This seems to be some manufacturer specific customization to Android N.
My questions are:
- is there a way I can navigate my user to the above screen (second), so i can request him to turn them off?
- is it possible to find out what intent it is (using adb logs or otherwise) so that I can navigate the user to it?
- any other ideas to work around this?
Edit: I tried cricket_007's comment below and below is adb output:
Running activities (most recent first):
TaskRecord{c79fa27 #421 A=com.android.settings U=0 StackId=1 sz=4}
Run #5: ActivityRecord{b7bd3c3 u0 com.android.lava.powersave/.ui.SmartAppManagerSettinsActivity t421}
Run #4: ActivityRecord{a55162f u0 com.android.lava.powersave/.ui.SmartAppManagerActivity t421}
Run #3: ActivityRecord{c91700c u0 com.android.lava.powersave/.ui.LavaPowerSaveManager t421}
Run #2: ActivityRecord{b60d04d u0 com.android.settings/.Settings t421}
It does seem to be a manufacturer specific customization, so I can't open the screen from my app. From other posts, it appears even Samsung phones have such feature. Any ideas of detecting or opening such screen for a generic case?