2

I've been using Alarm manager to show a notification at a particular interval of the day. When the application is killed/swiped away the functionality, which is right now to show a notification, stops working.

After reading answers on this thread : setExactAndAllowWhileIdle() for alarmmanager is not working properly

I turned off battery optimization for my app(which I can also do programmatically) and I started receiving notification even when the app is not running. I've experimented with work manager( which is still in alpha). It has the same issue, even though it says it will execute the task considering every possible scenario. And this issue is primarily with Oreo. Looking for a fix for the same. Will post code snippets if required.

Note: I want my app in the optimized list, thus I am avoiding that approach. Plus I've tried setAlarmClock too, the same issue persists, also it shows the time interval as an alarm on the home screen.

1 Answers1

2

I have had the exact same issue and after hours of researching, I found that 'Advanced optimisation' was limiting this functionality of my app on my OP 5T, and it ran fine on the Pixel 2 emulator. The setting is found under Battery -> Battery optimisation -> 3 dots -> Advanced optimisation. I am still yet to find out whether this comes preselected by default. OOS is 'optimising battery use' for my app, it works just as long as advanced optimisation is disabled.

Aden Diamond
  • 301
  • 4
  • 23