Search code examples
androidalarmmanagerandroid-alarmsandroid-calendarrepeatingalarm

AlarmManager or CalendarProvider, What should be used for an app like Keep or Evernote?


I am developing an android application just like Google Keep and Evernote. Now I want to add many reminders or alarms one time and repeated too. I have both options and I am confused.


Solution

  • I have faced this problem some time back. The answer to your question depends on two things:

    1. How much time do you have ?

    2. How comfortable are you with ContentProviders generally ?

    There are three ways you can approach this problem:

    1. Use AlarmManger and Service and roll your own SQLite db. This is the fastest & easiest way.

    2. Use CalendarProvider which will make use of its own internal Services & database mechanisms. This will require a valid Google Account belonging to the user, and moreover the user can also create / modify / delete alarms independent of your app.

    3. Create a custom ContentProvider with its own internal Services and its own SQLite db for CRUD operations. This is the most complex and most time-consuming approach, but you will learn a great deal. The advantage of this approach (besides the knowledge gained) is that a ContentProvider can share its data with other apps on the phone through a well-defined interface.