How to run task before the app is closed / force closed?

So I made an app with auto synchronizer services. I need to make sure the app gets the feedback after sending data to API server. The feedback is used to tell that the synchronizing task is completed.

I have a problem if the app is sending the data, before the feedback gets back, the app is closed. This will cause the app to re-send the data after the next initialization, which is bad.

How to wait for the feedback after the app is closed?

Note:

I am using Capacitor 3. In Capacitor 2 there is background task plugin, but it is deprecated now.

1 Like

Does this plugin work for you?

1 Like