Background task documentation confusing #3074
Unanswered
coffeymatt
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Any update on this? I am wanting to use Capacitor's Background API in the same way that coffeymatt is wanting to, and have not been able to find any solutions. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to get my head around background tasks. I have a 'synchronize' button in my ionic app that pushes up various bits of data. I subscribe to the observable of those events occuring and update the UI with messages, but I want that process to continue executing even if the user suspends/backgrounds the app.
The example code mentions 'let a network request finish' in the comments, but how would you get a handle on some code that's executing outside that 'appStateChange' listener function? That task id is only scoped inside the state change listener so I can't finish it in the final block of my observable? Does that make sense? Can this example be improved?
https://capacitor.ionicframework.com/docs/apis/background-task#api
Beta Was this translation helpful? Give feedback.
All reactions