Search code examples
androidalarmmanagerreminders

How to run code on future date in android


I am developing a birthday reminder app which will notify user on specified date the birthday event. I have googled web and found alarm manager in android to carry out my task.

But i just want to make sure is this the only way followed in making apps like reminder or we have some methods also

I checked this tutorial


Solution

  • Yes, Alarm Manager is what you want. Don't forget to register a boot receiver to set your alarms back up after a reboot.

    Also no this is not the only way. but other ways are more complicated still, and potential less reliable. For example you could save the date/time to a server, and have it send a push notification to set off the alarm at the appropriate time.

    However Alarm Manger was intended for things like this, so best use it. There is always more than one way to do things, and any clever person can come up with a hackish way to do something. But Alarm Manager is easy, and standardized.