I have an app which needs to communicate with a server (to refresh it's data) once every 24 hours. This needs to happen even if the app is not open, nor in the background.
Ideally what I'd like is:
Is any of this possible?
Is the app only woken up AFTER the user clicks on the notification? Or can I run some code before showing the notification?
Can I even discard the notification message?
If Push notifications are not the right way to do this, what is???
Thanks guys!
With release of iOS 7 this is finally possible using Remote/Silent notifications. They work same as Push notifications but instead of alerting the user immediately they can fire up background fetch mode and upload/download new content.
Here is simple tutorial:http://www.objc.io/issue-5/multitasking.html
This is only possible if your application is a Newsstand App, if it is, you can send a push notification with content-available: true
once every 24 hours.
If it is not a newsstand app, you can instead use GPS fences to run code. It is allowed to let the user set up GPS fences if they want the app to update when the user comes close to an area (ie. their home / work). This will wake the app and you can run the background download then. Instapaper for example does this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With