Periodic Background Update (including force-quit)

As the title says. We have a pretty specific need for our app, and I have an idea of how to achieve it, but would like input on whether it's good practice or not.

In communication apps such as Whatsapp or Discord, they need to send local notifications (and ideally update cached message data so it's fresh) anytime the user gets a new message. Conveniently for them, they control the backend, and so can just send out a silent push notification to the device(s) of user involved. In our case, we are creating a UI for someone else's backend, meaning we can't simply send a silent push on data change.

What we were originally thinking was a sort of crowd-source involving a combination of silent push and background refresh, but refresh won't work if the user closes the app. I've read all the given reasons for this, and though I still disagree, there isn't anything we can do about it. So what I'm now thinking is that, at whatever interval (say 1-3hrs) some serverless function sends a silent push to every single client, which will wake them up to make a fetch and compare to the cached data and send a local notification if necessary.

Downside here is it will likely incur some cost, and frankly it just feels kind of iffy as a solution, but I'm not sure what else we can do without controlling the backend API.

Thoughts? Is there anything I'm missing? Any better ideas?

Thanks in advance!

Replies

If you haven’t already, please read iOS Background Execution Limits.

As to your proposal, I suspect that this won’t work reliably. I see three potential problems:

  • If you user ‘force quits’ the app by swiping up in the multitask UI, the system won’t deliver silent push notifications to it.

  • The system has a budget to spend on background activity and it tends to favour apps that the user uses frequently. So, unless the user is dropping in and out of your app on a fairly regular basis, it may never see those pushes.

  • The user is able to turn off background app refresh, both globally and for a specific app.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I have read that page, and many others (I appreciate how often you answer these questions by the way), and I think I saw some posts that said it may have been possible. Evidently I, or they, was mistaken.

Is there any solution to waking up a force-quit app? We can't do non-silent push notifications without some check because the data handled is sensitive, and the server cannot know it. Do apps such as Discord and Whatsapp just do all processing as to whether the user should get a notification or not (such as checking muted, etc.) on the server and then send a non-silent notification?

Frankly, I'm out of ideas, other than the bad ones I've mentioned. Do you have any? Is there any way to do what we want to on iOS?

Thanks again.

  • Also, it would appear as though when I compile directly from Xcode to my device, it still sends a notification after swiping the app up. Is that only because it is being debugged?

  • Also, it would appear as though when I compile directly from Xcode to my device, it still sends a notification after swiping the app up. Is that only because it is a development build?

Add a Comment