Start a new topic

SQLite Databases within Android

I'm developing an app that has multiple sqlite db's and users will possibly be on multiple devices. Is there a way to save and retreive the databases using Kinvey? I'm new to Cloud in general and need any guidance I can get. Thanks.


So you have a couple options for approaching this.

The easiest way is to use our libraries offline feature, which takes care of maintaining the databases and syncing for you-- take a look at our offline guide and see if that'll work:

Basically, for this to work, you would have to first enable offline and then use appdata for all your save and get operations.

If that won't work because you need to manage your databases yourself, you can add a method to perform a sync. I would recommend adding an INT column to your databases, call it `synced` or something. Then, when new data is written to the database, set this flag to 0. Add a new method, call it `syncit(), which iterates through your databases, checks for a 0 flag on the synced column, and calls After the save completes set this flag to a 1. That will prevent every record getting synced every time, and allow you to minimize bandwidth usage.

Then, you can call this `syncit` method from a background service or directly from U interaction, so that it triggers scheduled or perhaps automatically when new data is added.

Let me know if that points ya in the right direction!
Thank you very much for your response. You gave me exactly the information I needed!

Login or Signup to post a comment