2

So I have alarm that when triggers it shows notification and sets up the same alarm with setExactAndAllowWhileIdle for next hour, but during night, like after successfully firing alarm 1 am, 2 am, then on 3 am alarm doesn't trigger, and of course of that it doesnt shows for next hourse, because it didnt set up new ones. When i wake my device at 8:15 am, it triggers this alarm.

Android 7.0, tested on Huawei P9

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jahusek
  • 117
  • 13
  • paste your code in question – Bipin Gawand Aug 19 '17 at 08:51
  • 1
    Doze could be to blame. Check [this](https://stackoverflow.com/a/33110418/6296561) – Zoe Aug 19 '17 at 08:52
  • 2
    but it is said that setExactAndAllowWhileIdle works even in doze mode, but somehow it doesn't – Jahusek Aug 19 '17 at 09:17
  • Possible duplicate of [setExactAndAllowWhileIdle - is not exact as of developer reference](https://stackoverflow.com/questions/33110246/setexactandallowwhileidle-is-not-exact-as-of-developer-reference) – Vadim Kotov Oct 31 '19 at 11:52

1 Answers1

1

Huawei has something called Protected Apps, that can be accessed from the phone settings (Battery Manager > Protected Apps). Try adding your app to this list to keep it running after the screen is turned off.

d777
  • 100
  • 1
  • 2
  • 10