Clarification Needed: Background App Refresh Interval

Hi,


We are developing a React Native iOS app that uses Background App Refresh to fetch data from server. We use a library called react-native-background-fetch. The readme of this library said that it's impossible to schedule a background task rate to less than every 15 minutes.


Because this library implements Background App Refresh and requires "Background Fetch" for Background Modes, I also checked the iOS documentations for background execution. What I have found in the explanation for setMinimumBackgroundFetchInterval: is that, it says "This value is advisory only and does not indicate the exact amount of time expected between fetch operations." and no notes are provided for UIApplicationBackgroundFetchIntervalMinimum.


We have also searched some of the questions on Stack Overflow and have got some ideas, but I would still prefer an authoritative answers from iOS engineers from Apple. So my questions are:


In the documentation, for setMinimumBackgroundFetchInterval:, there is no indications for something like a range of interval that we can expect. We are experiencing the background app refreshes as frequent as around 15 minutes to more to 6 hours. Is this the normal expected behavior and is there a range of interval that we can expect?


Any suggestions on what can we do in the app to "tell" the iOS system to schedule as many background app refresh fetches operations as possible?


It would be great if we can have an official clarification and suggestions on this topic and we really appreciate your help.


Thanks,

Ryan

Replies

We are experiencing the background app refreshes as frequent as around 15 minutes to more to 6 hours. … is there a range of interval that we can expect?

The expected range can vary wildly. It will never be less than the minimum that you’ve specified, but it can be much longer.

Keep in mind that the goal of background fetch is to allow an app to update so that it appears ‘live’ to the user. Thus the rate at which you get background fetch events is very much dependent on user behaviour. For example:

  • If the user runs your app often, it’s likely you’ll get frequent background fetch events.

  • If the user runs your app at specific times of the day, the system may notice this and give you a background fetch event shortly before that time.

  • If the user runs your app very rarely, the system may cut you off from background fetch events entirely.

Any suggestions on what can we do in the app to "tell" the iOS system to schedule as many background app refresh fetches operations as possible?

No. That’s not something that’s aligned with background fetch’s goals.

My general advice is to not rely on background fetch for critical functionality. It’s great for keeping things looking ‘live’, but if being up to date is a critical part of your app’s user experience then you should explore other options, and specifically you should look at moving this work to a server and then notifying the user of events via a push notification. That way you can user mains power for this polling, rather than eating into the user’s battery.

You can also notify your app of these events via a silent push notification, but be aware that these are subject to a budget and thus you may run into problems like you’re seeing with background fetch.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • Thanks @eskimo for the detailed answer above. I have a similar situation where sometimes the application takes more than 5/6 hours to wake the application in background and when the application is brought to foreground and then sent to background. Background refresh happens often. But when we leave the application in background for long then it does not trigger the background refresh task. Does it mean it depends on the application usage and when it's being used so that it can wake it well before time to perform the job? In my application I am doing everything as per the documentation but the time interval is a concern.

Add a Comment

Thank you very much for your timely and detailed answers. I find the insights and design ideas really helpful.

Does it mean it depends on the application usage … ?

Yes. If you’re curious how this stuff fits together, we gave a great talk about it at WWDC [checks calendar] last year, namely WWDC 2020 Session 10063 Background execution demystified.

Share and Enjoy

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

  • Thanks @eskimo

    Does it mean, if I set a value for setMinimumBackgroundFetchInterval as one minute, there is a possibility to execute the task in 1 minute? Or the minimum interval might be more or equal to 15 mins?

Add a Comment