I am using kinvey as a backend to store some data. Everytime the user answers some questions on the phone(Android), the data is sent to kinvey immediately. But there can be a scenario where the user is not connected to the internet, so sending the data has failed. I would like to know if there is any standard way to storing the data that hasnt been send in an efficient manner? Also how often should I try to resend the data that has not been sent? I would typically just put it in a db, and try to send whatever is in that table every 30 minutes or so and clear the table if the send is successful? Would this be ideal? Also I see that Kinvey doesnt have a mechanism to handle this automatically(correct me if I'm wrong).
Thank you for any suggestions.
Local database is a good place to store your data securely. The thing is that you are sending data after every 30 min, you have to change that scenario.
Below are the steps:
Check Internet connectivity, if available than work online no need to store data locally
If internet is not available than store it in local DB
You are able to get Internet connection broadcast from system whether it is connected or not if you get connection at that time sync your data with the server (No need to check every 30 min) (System always broadcast when it get connection)
You can took a look at Firebase, feature that you're looking for is described in Offline Capabilities. If migrating from Kinvey is not an option - then store your data inside a DB and use JobScheduler
to sync it to the backend when the conditions are right.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With