Search code examples
iosnotificationspush-notificationibeacon

Silent push notifications and iBeacons


I have developed a small iBeacon based application, when the application detects one of our iBeacons makes a call to a web service to obtain a data set and send a local notification to the user. All this is working correctly.

I have now raised the idea that these local notifications could vary over short time intervals, with new content. The problem is that if the user does not leave the region of the iBeacon and reenters, the application will not "wake up" and the user will not receive the new updated notification.

After asking for advice on how to tackle the problem, someone suggested using remote notifications. Reading about it I found the silent remote notifications, but I'm not sure if I can use them as I'm thinking.

My idea is this, when a notification is modified or created and is associated to a iBeacon on the server, sending a silent push notification to the application so that it "wakes" if not in foreground. Thus, when the application "wakes up", you can do ranging few seconds, and if any iBeacon near detect and send the new notification.

Is this possible and permissible? I can send all silent push notifications that I want or is there some limit?Thanks


Solution

  • This is possible and permissible. You can read more about this in the Using Push Notifications to Initiate a Download section here:

    https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

    However, there are a few drawbacks:

    1. Remote notifications can be slow to arrive, and are actually not even guaranteed by Apple to arrive at all.

    2. They are a bit of a headache to set up given that you need to build server ifrastructure to send them.

    A less timely alternative is to just do periodic refreshes, but the OS typically lets your app do this only once a day. See Fetching Small Amounts of Content Opportunistically here:

    https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html