0

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.

1 Answers1

2

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

Community
  • 1
  • 1
Caner
  • 57,267
  • 35
  • 174
  • 180
  • Thanks Vegas, Is that the only way it can be done??? I would prefer this to be an option and they not have to update the whole app, therefore not have the updates available icon sitting in their tray. Right now I have 15 updates available and I keep having to clear them or uninstall the apps! People don’t like apps telling them there are updates available. –  Dec 08 '11 at 12:47
  • Inside `onUpgrade` you can launch a message box asking user for approval. – Caner Dec 08 '11 at 12:49
  • Thanks Vegas, you sent me in the right direction and I get it now. It’s one of those programming things that are a pain to test, like email forms! Cheers, Mike. –  Dec 08 '11 at 21:04