What happens to my Android app and database when a user updates through Market Place?
Asked Answered
A

1

1

Ok, I currently have an app on the MarketPlace and today I release its first update. Will the SQLite database used by my app be overwritten by the update, thus calling the onCreate once again? Or will it simply not touch the database? What happens to the SharedPreferences?

Sorry for the seemingly simple questions, I've been googling for an hour now and haven't found anything on what happens to a package when the user updates the app. Does it totally wiped out and reinstalled? Dunno. Any help will be highly appreciated. Thank you!

Anomalistic answered 28/11, 2010 at 4:46 Comment(0)
T
1

if you are using sqlite inside your db adapter, it will check for this variable:

private static final int DATABASE_VERSION;

If it's different than the one installed in user's device, it will attempt to call the overridden onUpgrade() method of sqlite.

Teocalli answered 28/11, 2010 at 4:51 Comment(3)
Hmmm, makes sense. I was hoping I wouldn't have to mess with onUpgrade. I guess I can drop the existing table and recreate it. One more question, are files in the asset folder completely replaced? Thank you so much for your answer.Anomalistic
You could just call onCreate() on your upgrade after dropping all the tables. I think it's either completely replaced or is synced.Teocalli
Awesome, thanks again for your help, now let me go turn my v1.1 into a v1.1.1 :-)Anomalistic

© 2022 - 2024 — McMap. All rights reserved.