1

I am making an alarm app for waking up user at an exact time. I am using JobIntentService (since Android O+ devices don't support background services) for showing a notification alarm like this:-

(AlarmManager -> BroadcastReceiver -> JobIntentService -> ShowNotification).

But now on Android O+ devices the JobIntentService gets delayed due to the doze mode and the notification alarm is not shown at the exact time.
Even when i use setExactAndAllowWhileIdle() the AlarmManager gets out of doze mode but JobIntentService still gets delayed.

I can't figure out any alternatives for my case/scenario other than the option below:-

Since the user will have to play a game to stop\snooze the alarm, a persistent foreground service will keep playing the alarm until user opens the app(by tapping the foreground service). The alarm will be kept playing until the user plays the game. The foreground service (on-going alarm) will stop once the user is done playing the game.

syed_noorullah
  • 155
  • 2
  • 13

0 Answers0