Please provide the following:
- SDK Version: 46
- Platforms(Android/iOS/web/all): iOS
The default behaviour in iOS seems to be that network calls made while in foreground are interrupted/cancelled as soon as the app backgrounds.
I have to make a network call to login, part of which requires confirming a code in another app, i.e. I make the login network call, background the app to go another one to confirm some verification number (the login call should still be ongoing in my Expo app) and then I go back to my Expo app and the login call finishes.
This is not working in iOS as the login call gets cancelled as soon as the app is backgrounded.
I’ve tried implementing this as a background task, but I feel weird about that as the use case for background fetch tasks seems to be recurring network calls at some interval, while my use case is just running this network call once, but make sure it survives being backgrounded for a short while.
When I implemented the background task - it also didn’t run immediately, but instead ran after several minutes after being in the background.
My questions are
- Is there a way to implement my desired behaviour without using
expo-task-manager
andexpo-background-fetch
? - If I have to use a background fetch task, what can I do to run it immediately (and only once)?