Start in foreground and finish in background if app closed?
See original GitHub issueI’m not sure if I’m missing something, but is it possible with this library to start a task in the foreground and finish it despite the app going to the background?
To give a more concrete example: I press ‘Send’ on an email—a process which in total takes a few seconds—but leave the app before it’s finished. I would like this process to continue and finish in the background after I have left the app.
There is a beginBackgroundTask
which seems to be used for this exact scenario. However, as this is not implemented, I guess this is not within the scope of this plugin?
Thanks in advance, and thanks a lot for the work on this plugin!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Run code when Android app is closed/sent to background
To check if your application is sent to background, you can call this code on onPause() or onStop() on every activity in your...
Read more >Restrictions on starting activities from the background
Note: For the purposes of starting activities, an app running a foreground service is still considered to be "in the background". This guide...
Read more >Windows background apps and your privacy - Microsoft Support
Stop an app from running in the background · Select Start , then select Settings > Apps > Apps & features. · Scroll...
Read more >Timer im background Task not possible? - Apple Developer
As Claude31 says, running timers in the background is tricky because, in general, the system will suspend your app shortly after it moves...
Read more >Auto-Start Foreground Service in Android - Medium
This permission is required for running the foreground permission which tells that your app going to run the foreground service. If you want...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jehartzog My issue is not the time limit, but rather the use case I explained in my first post.
I need the process to continue when the app goes to the background, not run periodic background fetches when the app is already in the background.
I managed to implement this with
beginBackgroundTask
by creating my own plugin and wrapping tasks that need to continue if the app is closed withbeginBackgroundTask
. Without this, the process (e.g. sending an email) is immediately canceled when the app goes to the background, and the email is not sent.So the question is: is it possible to do this using react-native-background-fetch as well?
@alexandersandberg Looks like you still may only get 30 seconds when using that call: https://developer.apple.com/forums/thread/85066 .