I need to set a number of alarms that repeat weekly, to automatically put the phone on vibrate when the user is on some class (it's an academic app) and then reset the volume when the class finishes.
I already have the alarms being created, but I must have a way to deactivate all of them if the user disables this feature. I also know I must do so by passing and intent with the same parameters to the AlarmManager.cancel() method, but the problem here is:
The user can cancel classes and enroll in classes (but not directly in the app), and that's updated and reflected on the DB, that keeps just the current classes. So if I have an alarm setup to a class that doesn't exists anymore, how can I cancel it if I can't replicate the PendingIntent?
One solution I see here is to create a db table to track the current alarms, then I'd have full control on them, another way would be to cancel and reset all alarms when the class list is updated, but doing so takes a fair amount of time, and a 3rd but less friendly option would be to simple wait for the user to boot the phone, and when reseting the alarms just set the ones I need (correct if I'm wrong on this boot behaviour). Is there a fourth option I should try, or one of these if good enough?