search

Home  >  Q&A  >  body text

How do I set up my Expo app to automatically perform tasks every 5 minutes?

I have an app created using React Native and Expo. I need the app to send a notification to the smartphone every 5 minutes if there is a new order with nearby GPS coordinates. I'm trying to figure out how to do this. I've tried creating a BackgroundFetch task that checks my backend every 5 minutes for available orders, but in Expo Go the task doesn't run every 5 minutes but randomly. Does anyone have any ideas?

P粉285587590P粉285587590447 days ago495

reply all(1)I'll reply

  • P粉415632319

    P粉4156323192023-09-11 15:50:45

    Try using setInterval => "Repeat the callback function every delay milliseconds."

    setInterval(() => {
         sendNotification()
        }, 5000);

    Hope it helps you.

    reply
    0
  • Cancelreply