I'm building a reminder app. And when reboot the device, the alarms already have been set as pending intent
in alarm manager is destroyed. So when reboot:
- Wake broadcastReceiver
- BroadcastReciever calls an Activity
- This Activity sets pending Intent again.
It worked well. However, I used an Activity, so this Activity shows up on the display a second after reboot. That's not really good. So I want to make this work on background.
Then, I noticed I can use IntentService
.
However, IntentService
is deprecated in API level 30.
Also JobIntentSerive
is deprecated too.
I'm very confused. What should I use to make this work on background? Thank you.
CodePudding user response:
You can reset the alarms directly in the BroadcastReceiver
called at boot time. You don't need to launch any other components to do this.