S
S
Sergey Chuprin2015-02-16 19:45:09
Android
Sergey Chuprin, 2015-02-16 19:45:09

Android: how to make the alarm go off after restarting the device?

My goal is to show notifications scheduled for a specific time. There are two services for this - one for scheduling and setting an alarm, and the second for showing a notification when the alarm goes off. I start the alarm clock in a separate thread. I started the service after a reboot using BroadcastReceiver and setting permissions android.permission.RECEIVE_BOOT_COMPLETEDin the manifest and intent filter android.intent.action.BOOT_COMPLETEDfor the receiver. I tried returning the START_REDELIVER_INTENT flag in the onStartCommand() method, but that didn't work. How can I make already assigned notifications be shown after rebooting the device? At least theoretically.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bimeg, 2015-02-16
@bimeg

Save information to the database about the fact that the notification is hanging. When deleting it, delete it from the database. And with BOOT_COMPLETE restore.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question