Reputation:
I have an app receiving its data from a database in the assets folder. Now everyone has the app on their phones I want to update the database. I have the new database ready to go on a server, but how to I get the updated database into the assets folder on their phones. All only if they want to update of course???
Cheers,
Mike.
Upvotes: 0
Views: 1383
Reputation: 59178
SQLiteOpenHelper
constructor has an version
argument. If you supply some number that is bigger than the existing database version in phones memory, onUpgrade
function will run after getWritableDatabase
is called. Inside onUpgrade
you should handle updating your database.
Some example code here: Question about onUpgrade method android
Upvotes: 2