Automatically uninstalling the older app before in

2019-07-31 03:22发布

问题:

I published my app on play store and I have made an update that may cause the older one to crash due to some database structure changes that I have made and I have had a hell of hustle trying to automate DB migration upon installation. So I want the to completely auto-uninstall the old one from users phone before new one is installed during update as an easy solution. Is there a way I can include such configurations?

回答1:

No, there is no way to force uninstallation before installation. But it sounds like you could just delete your DB on upgrade using SQLiteOpenHelper



回答2:

If you use GreenDAO you can use the schema version Schema schema = new Schema(, "greendao");

when increasing the schema version GreenDAO will empty your DB and update the schema, and then you can repopulate it from the server (if applicable)