I'm making an Android application, but i've got a problem. I've no clue what's the easiest method to update the database within the client application from the server (when the user click on the "look for update" button). How must i set the present database version in client-side to ensure that i'm able to attempt to match up against the most recent database version in server ? how must i check from server if there's any new database update ? must i use PHP / java server ?
My Situation : User installed my application that include an sqlite database version 1. But later, i up-to-date the sqlite database to version 5. and upload it to server (i havent consider what type of server am i going to use, any idea (java or php) ?) and that i want once the user click "look for updates", the application will look for the most recent database version, when the latest db version is 2. (that is >1.) it will download and replace that old sqlite db (1.). How must i set the sqlite database version in client-side (Android) and compare it using the latest version in server-side?
Any assistance will be really appreciated. Thanks !
According to your comment to this answer...
In case your issue is that easy I recommend to complete following:
- Request your server for latest latest database condition via HTTP (it might return a timestamp or database version) e.g. with
- In case your local database is less then your came back timestamp or version you pull the database from server e.g. with
- You then persist the timestamp or version (for instance inside a shared preference)
Your server always knows which version may be the latest and may update the came back timestamp or even the came back (and incremented) version number...
PHP or Java: I would suggest PHP for such an easy task (also because every webspace offers that option). I'd understand that with a simple GET request (like shown before). Java is simply overkill (but nonetheless possible).