transistorsoft / react-native-background-fetch

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

Question about configuring headless tasks. #471

Closed alexey-kuznetsov closed 6 months ago

alexey-kuznetsov commented 6 months ago

Your Environment

Do I understand correctly, that if I need to run headless tasks, I need both: BackgroundFetch.registerHeadlessTask in index.js and BackgroundFetch.configure in App.js? If yes, I have two questions:

  1. Does it mean that I can define different callbacks for headless and usual tasks?
  2. Is it ok, that we define configuration options for headless task in App.js file that is not loaded in headless context?

Sorry to bother you and have a nice day!

christocracy commented 6 months ago

Does it mean that I can define different callbacks for headless and usual tasks?

Yes.

Is it ok, that we define configuration options for headless task in App.js file that is not loaded in headless context?

What do you mean by "options for headless task"?

alexey-kuznetsov commented 6 months ago

@christocracy I mean configuration options such as minimumFetchInterval and other.

christocracy commented 6 months ago

You MUST call .configure and provide the documented Config. If you don't provide minimumFetchInterval a default of 15 is used.