Set certain time intervals between fetching using expo-background-fetch

Please provide the following:

  1. SDK Version: 38
  2. Platforms(Android/iOS/web/all): Android

So, I read the docs but I am still confused.

I am trying to run an API call each 5 minutes (If I understood the docs correctly, for Android by default the timer is set to minum 15 minutes), the problem is that I dont know how to set this interval, currently my task is getting run at random intervals of time. Sometimes 5, somtimes 2, sometimes 3.
Is there a way to set a certain time interval?

Can I get some enlightment please?


1 Like

I’m having the same issue… I’m trying to make a simple background call to console.log a message, but I cannot get it to actually fire on the interval (5 seconds). Sometimes it will happen right away, other times it’ll wait a few minutes.

It seems we cannot do this, I think we have to eject from expo if we want to accomplish this feature

Yes, that is the conclusion I came to as well. Ejecting from Expo is a last resort for me, but there just doesn’t seem to be any better option.

let me know if you succed, I am stuck with: Errors trying to eject (Could not locate a valid AppDelegate at root)

I eventually got it to work, but I found that ejecting from expo was more of a headache than just creating a brand new project using React Native CLI and copy + pasting my old code into the new project. It still requires some debugging to get things working, but overall easier in my opinion.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.