Reminders in android can best be implemented by using the AlarmManager
. Why? See what the official documentation has to say about it:
These allow you to schedule your application to be run at some point in the future.
Additionally:
The Alarm Manager is intended for cases where you want to have your application code run at a specific time, even if your application is not currently running. For normal timing operations (ticks, timeouts, and so on) it is easier and much more efficient to use Handler.
This means you have come to the right place if you want to implement such a feature as a reminder. The alternative class to handle such a task, Handler
, is best suited for tasks that are expected to be completed while the app is still in use. Your app will definitely have reminders spanning days, and probably weeks or months, so it is best to use the AlarmManager
class.
This is how it will work, your app will start a background service to kick off the timer for the reminder, then send a...