transistorsoft / react-native-background-fetch

Periodic callbacks in the background for both IOS and Android
MIT License
1.43k stars 191 forks source link

React Native 72, TestFlight iOS event never fires #460

Closed timothyerwin closed 9 months ago

timothyerwin commented 9 months ago

Your Environment

let status = await BackgroundFetch.configure(
  {
    minimumFetchInterval: 15,
    requiredNetworkType: BackgroundFetch.NETWORK_TYPE_ANY,
    stopOnTerminate: false,
    startOnBoot: true,
  },
  onEvent,
  onTimeout,
);

Expected Behavior

Background Task should fire after some time 15m+

Actual Behavior

Never see the event in the logs

Steps to Reproduce

N/A

Context

Start the app, background it, wait for some time and check logs

Debug logs

N/A

Questions

Hey, first of all thanks for the great library. I've read around the docs and issues and it seems the response is that if you run the simulated event in XCode that's all we can do. The simulated event does work and fires the event in the app.

I have a few questions:

  1. If there might be any issues with TestFlight builds not triggering background events?
  2. If there is some average typical amount of time that you could expect the background event to fire? (i.e., it generally would fire at least once in the first day)
  3. Does the event mechanism still work if it's inside an authenticated route? i.e, not in App.js, but in some nested component?
  4. Does it need to use Headless JS, or is that just for enabling scenarios where the app is also terminated?

Again, thanks a lot for this library and taking the time to answer the questions.

christocracy commented 9 months ago

These questions have been posted dozens of times over the last 9 years. The answer is always the same: if simulated task works, that’s all you need to know.

  1. No
  2. It can take days
  3. Doesn’t matter
  4. HeadlessJS is android-only. There’s no such thing as headless iOS. If the user terminates the app, iOS halts fetch events. There’s no such thing as stopOnTerminate: false for iOS.
timothyerwin commented 9 months ago

awesome. and, just on queue the events finally started firing on ios.

thanks so much for the clarification and the awesome library!