When an app is uninstalled, is its SharedPreferences database cleared?

by RockPaperLizard   Last Updated June 12, 2019 21:11 PM

When an app is uninstalled, is the data in its SharedPreferences database deleted?

If not, without a device being rooted, is there any way to clear that data? (Or at least view it?)

Answers 2

SharedPreferences database always deleted when app is uninstalled. but In Manifest
android:allowBackup="true" If allowBackup is true then data is not clear even if application is uninstall then install. so always keep allowBackup false when data do not want store.

June 14, 2019 05:06 AM

SharedPreferences are actually saved in a file in the app private directory: /data/data/package_name/shared_prefs/somefilename.xml

When an app is installed this directory and file are automatically created. When an app is uninstalled this directory is deleted along with its parent /data/data/package_name UNLESS the app is uninstalled in order to update it. From command line this is done using the flag -k or -r that is

adb uninstall -k package_name - Keep the data and cache direct­ories around after removal

adb uninstall -r package_name - Reinstall an existing app, keeping its data

Gogu CelMare
Gogu CelMare
June 14, 2019 06:21 AM

Related Questions

Updated April 03, 2015 21:22 PM

Updated July 13, 2015 15:04 PM

Updated July 28, 2015 13:04 PM

Updated September 27, 2016 09:04 AM

Updated June 22, 2016 08:04 AM