开发者

Android - Update database in app from web

I have an app 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 store it on the web. Then everytime the app loads, it will check the web for a new version. If there is one, it w开发者_如何学JAVAould simply download it and replace it. What is the best way of doing this?


Someone else will have to tell ya the best way to initiate the actual download, but this blog post may be helpful in figuring out how to install the database once downloaded.

Also, you may find this question I posted earlier useful in determining database versions, basically I'm just parsing the file name to determine version. I'm sure there's an easier way for you though if you're communicating with a server.


You got several options to tackle this problem:

  1. Download a xml or json file from your webserver, parse it, clear current database and import new data.
  2. You could directly save a text file on your webserver with sql statements and directly execute this prepped sql file to you sqlite database.


Well, you can update the whole apk via internet just checking it's version and checksum, and every new version should contain new DB version and necessary instructions which can be executed with a little help of SQLiteOpenHelper Or you can update your db via simple XML container over HTTP...


you can have a separate table in each dbs to keep the version updating. so every time you load the app you can call a web service and get the current version of the db which you store in the web server. if its newer than the db which you have, you can simply replace it.

you can use .Net web service which has the method to get the version of the db which stores in web, and with the help of ksoap library you can invoke the .Net web service and get the results.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜