I am keeping some application meta data in SharedPreferences
. Whenever I uninstall the application and reinstall it, the SharedPreferences
are deleted.
Is there any way to get that to remain, so that if the user does an uninstall and reinstall, they can recover their old data?
Since Android 6.0 it has been possible to use:
<application
android:allowBackup="true">
By setting it to true your data (sharedprefs and others) will be saved on Google cloud and restored next time the app is installed. You can read more about it here. It should be noted that the default settings is true since 6.0.