Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Meteor in offline mode

Tags:

meteor

I would like to know if Meteor can work with my use case.

I have a mobile application that will be available on the App Store. This app contains a small survey that users will respond without internet connection. Then the user will close the application. I then want to transfer the data to the server when the application will be online.

For now, when the application is left open, the data is transfered when app become online. However, when the application is closed and reopened the data that has been entered in the application is lost.

I tried the GroundDB package, but I did not manage to make it work to meet my need.

Can Meteor work with my use case (with or without package)? Do you have any examples or suggestions?

Thanks

like image 368
stivaugoin Avatar asked Apr 28 '15 14:04

stivaugoin


1 Answers

You should be able to get this to work by storing the session data between sessions in the localSession object. You can simply use the amplify package to do that storing for you.

Just make sure to store the data from the survey in amplify, e.g., like this:

amplify.store("survey_data", data);

On startup on the client, you can check whether this data exists:

if (amplify.store("survey_data") { .. } 

and then upload it to the server, using a method or inserting into a collection.

Note, this won't happen in the background, but it should work if the user reopens the application.

like image 91
Christian Fritz Avatar answered Oct 03 '22 15:10

Christian Fritz