Android Question Database question

anaylor01

Well-Known Member
Licensed User
Longtime User
So I did a Release to my device. It is giving me an error that a field is missing. The field is present in the database file that included in my project. So can someone explain to me how this works? Shouldn't when I do a release and then an install that the database that is attached to my project get updated also?
 

anaylor01

Well-Known Member
Licensed User
Longtime User
So lets say that my app was finished and on the market. Lets say I had to make a change to the database. How would I update it? And how do I update the one on my phone now?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
In simple terms, after updating/installing the app, check the DB on the device (you can check the number of columns, version, etc) if it matches the latest version, you are done, otherwise, modify the DB adding/removing the necessary columns.

There are samples posted in the forums, do a little research.
 
Upvote 0

anaylor01

Well-Known Member
Licensed User
Longtime User
So can I delete the existing and then use the new one? It seems like it would be a lot easier if every time you installed it would overwrite the existing database with the new one.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
FWIW, I actually build the database on the device on the first install of the app (I don't distribute the DB in the apk), then on every startup of the app I run a validation routine. That way if I make any structural changes to the DB (eg: add or drop a table, add a field to a table, etc...) the validation routine makes the required changes & brings the DB up to date without deleting any of the user's data.

- Colin.
 
Upvote 0
Top