Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Calendar monitoring in the background - how is it done?

I'm researching how to add notifications to our app when an event is about to start. Other just-calendar apps provide this functionality but my research has me baffled about how they accomplish this.

According to the Apple docs: For tasks that require more execution time to implement, you must request specific permissions to run them in the background without their being suspended. In iOS, only specific app types are allowed to run in the background:

  • Apps that play audible content to the user while in the background, such as a music player app
  • Apps that keep users informed of their location at all times, such as a navigation app
  • Apps that support Voice over Internet Protocol (VoIP)
  • Newsstand apps that need to download and process new content
  • Apps that receive regular updates from external accessories

Ok, well, a calendar app is none of these. If I schedule local notifications for my app to periodically wake up and check the calendar, that will not suffice, afaict from the reading I've done. Using the location monitoring option will not suffice - what if my user sits in his/her office all day long?

Calendar events can be added/deleted from other sources beside the phone, obviously, so setting up a bunch of notifications when my app starts is not a solution.

How do the calendar apps accomplish pre-event notifications? I have several calendar apps from the App Store and they do this so I know it can be done. My app will need to be acceptable by the App Store as well, so I can't fake VoIP as a solution.

Additional info: after more research, the apps I see doing this do not update when they've been shut down (duh), but they do some background updates. I'm still unclear as to how to keep my background process going for a long time (e.g. overnight).

like image 406
Janene Pappas Avatar asked Jul 19 '13 17:07

Janene Pappas


1 Answers

Check this answer. You can subscribe to EKEventStoreChangedNotification to get notification for any change in calendar. https://stackoverflow.com/a/12324363/1187485

like image 126
Bhanu Birani Avatar answered Oct 16 '22 00:10

Bhanu Birani