7

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).

Janene Pappas
  • 1,366
  • 12
  • 26
  • Have you read this? I believe that it answers your question http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html – Ben Pious Jul 19 '13 at 18:18
  • 1
    Yes, I have read that, but it doesn't address how to monitor for changes in the calendar. Just setting up a bunch of local notifications when the app is opened won't accomplish the need for reacting to changes in the calendar and providing the user with a notification that an event is about to start. – Janene Pappas Jul 19 '13 at 18:24
  • If all you want to do is remind users of events, and the calendar is being stored and updated somewhere remotely, what is wrong with using push notifications for events that haven't yet been synced onto the iOS app's calendar? – Ben Pious Jul 19 '13 at 19:22
  • 1
    How would the push notifications get set up in the first place? My app goes off of what is in the iOS calendar. If someone adds an event to a calendar via another mechanism (e.g. Google Calendar or Outlook/ Exchange) my app is not going to know about them unless it has a chance to monitor the calendar. I don't have a server pushing events to a calendar, just the app on an iOS device reading the user's calendar. – Janene Pappas Jul 19 '13 at 20:23
  • You can do it with background fetch.[This answer may helps](http://stackoverflow.com/a/23997912/832111). – d.ennis Mar 20 '17 at 19:25
  • Possible duplicate of [Receive and respond to EKEventStoreChangedNotification in the background?](https://stackoverflow.com/questions/22365107/receive-and-respond-to-ekeventstorechangednotification-in-the-background) – Jeremy Mar 27 '18 at 21:29

1 Answers1

6

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

Community
  • 1
  • 1
Bhanu Birani
  • 1,286
  • 1
  • 13
  • 22