You should be able to make this work by storing session data between sessions in a localSession object. You can simply use the amplify package to do this for you.
Just remember to save the data from the survey in the gain, for example, as follows:
amplify.store("survey_data", data);
When launched on the client, you can check if this data exists:
if (amplify.store("survey_data") { .. }
and then upload it to the server using the method or paste it into the collection.
Please note that this will not happen in the background, but it should work if the user opens the application again.
source share