Android - update the database in the application from the Internet

I have an application with a database full of information. The user never changes or adds anything to this database. I would like to update the database myself and save it online. Then each time the application loads, it checks the web version for the new version. If it is, it will simply load it and replace it. What is the best way to do this?

+6
source share
4 answers

Someone else should tell you that the best way to initiate the actual download, but this blog post can be useful in determining how to install the database after it is downloaded.

You can also find this question . I published earlier useful in determining database versions, basically I just parse the file name to determine the version. I am sure that for you an easier way if you communicate with the server.

+2
source

You have several options for solving this problem:

  • Download the xml or json file from your web server, analyze it, clean the current database and import the new data.
  • You can directly save the text file on your web server using sql statements and directly execute this prepared sql file for your sqlite database.
+1
source

Well, you can update the entire apk via the Internet just by checking its version and checksum, and each new version should contain a new version of the database and the necessary instructions that can be performed with a little help from SQLiteOpenHelper Or you can update your db through a simple XML container over HTTP ...

0
source

you can have a separate table in each dbs to update the version. therefore, every time you download the application, you can call the web service and get the current version of db that you store on the web server. if its a newbie than the db you have, you can just replace it.

you can use the .Net web service, which has a way to get the version of db that is stored on the network, and with the ksoap library you can call the .Net web service and get the results.

0
source

Source: https://habr.com/ru/post/889960/


All Articles