简体   繁体   中英

Android - Package files folder will be deleted while upgrading an app in Google PlayMarket?

I had developed Android Application which has Login Authentication Page. When the user logs in with valid data, the details are stored in Shared Preferences (shared_prefs folder in data/data/<App_PackageName>/<shared_prefs> folder as SharedPreferences.xml file). So when the user minimizes and maximizes the App, the Shared Preferences is working fine. I recently upgraded the App in the market with updated version Name and Version Code. The users gets the notification and upgrading the App from the market. While launching upgraded version, the app is displaying the Login Auth Page again. I thought that shared Preferences are deleted while upgrading the app, so i changed the storing the details from Prferences.xml to .txt file. The text file is storing in data/data/<App_PackageName>/<files> folder. Here my questions are:

1.The `files` folder and `shared_prefs` folder are stored in cache memory?
2. Whether cache will be cleared while upgrading the app from the market?

Neither are stored in the cache memory, the correct term is private application storage. Application database goes there too. All these will be kept intact when you upgrade the application.

There will be very little use of the application storage if it got erased with every application update right? Imagine yourself having to pass the same troublesome level of a game after each upgrade...

By the way there is a warning that pops out when you are about to upgrade an application, saying explicitly that your application data will be kept intact .

Preferences aren't automatically deleted when you simply update the app. Either the user is uninstalling first, or they are using a 3rd party market alternative which is uninstalling or deleting your preferences.

Or you have some code in your app that determines the version of the app is newer than the version was the last time your app was run, and then clears your settings manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM