Alarmmanager and Broadcastreceiver stop working when mobile is turned off

Asked

Viewed 57 times

0

I created an Alarmmanager that calls a Broadcast that triggers an event that should happen from time to time. This working but if I restart (turn off/on) the phone loses service and no longer the alarm is triggered.

How can I fix this?

  • In theory, you have to agree your application in this case. Then you use the Wake Lock, and for this you must give permission in the manifest. Example: <uses-permission android:name="android.permission.WAKE_LOCK"/>... Look at this question

  • Now in practice, it is not working for me yet, but even so I marked the Ramaral answer as valid, but to ask doubt with him later, because I had already filled his bag too. I have to do other tests yet. For it worked there, I believe.

  • @Acklay Tell me what’s not working so I can try to solve.

  • @Acklay I tested again and the notification appears the next day after I disconnected and turned the device on. Don’t forget that if you turn on your device after the time the notification was scheduled for, it won’t show up.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.