Send informations too server without connection


As my title suggests, I encounter an interesting problem and I would like some advice on how to solve it. I am making an application to the user to make reports. This report will possibly be in a place outside the 3G network (mountain / forest).

But I need to take the exact date of the event and transmit it as soon as possible. So I need to keep the data that I can not send and send them when I can .

So I proceed like so:
The user opens the application and made a report.
Recording the data on local in the phone.
Sending the data on the server. (Deletion of data if the transfert is successful)

But if the user is off-network, my data can not be sent correctly. And if he closes the application meantime, my data will only be sent only when it will reopen the application and I will check if there are unsent datas.

My question is this: Are there any way that after a delay, even if closed my application continues to work until it has caught a network and sent the data?

If so, I would greatly appreciate having tracks on how to do it.

Thank you for taking the time to read my post and for the time you will take to respond.



After search a long time i have found this plugin : cordova-plugin-background-app

He look like what I need. He allow your application to run in background. So, you just need too give him a function wait for ā€œ3gā€. And send your datas otherwise.

Peace :wink: