mercredi 23 décembre 2015

Update app with sqlite, keep user data

Although I don´t have my app on Google Play, but now i am interested in updating app. I use existing database in Assets folder which is just copied and created real one for app. After app update, it is again the whole database remake? That means, user lost them data. How can I protect from this? Thinking about 2 options:

1 - In app update just use many Insert methods (maybe 200 or more) by onUpdate(...)

2 - For every table, for example T1, I make another one, specially for user data, for example T1_user. Data with query(id) in T1_user will belong query(same id) in T1. In update, I will replace whole T1 db(new have 50 queries more) and in T1_user I just add 50 queries.

Is that possible? Or is there another option?

Aucun commentaire:

Enregistrer un commentaire