Reputation: 729
I'm building a flutter-firestore live POS system and have largely stayed away from using local data persistence like SharedPreferences. My concern is that I don't know if I need to clean up local resources once app is deleted or how to do so.
Upvotes: 0
Views: 934
Reputation: 846
SharedPreferences is deleted once app is uninstalled. In case of updates, SharedPreferences is not deleted. But remember one thing. always remember to include all the SharedPreferences values of the previous versions while launching an update. For example, you had put a few SharedPreferences values in the first version. So, in the next update, the users will have all the SharedPreferences values from the previous version. But if a user, who did not have the previous version, install the next version for the first time, he/she will not have the SharedPreferences values from the previous version. So, make sure to include all the previous SharedPreferences values in your updates and put them accordingly if they are not found in the device.
Upvotes: 1
Reputation: 154
SharedPreferences
is always deleted along with the app uninstall.
When you uninstall any application all the changes the application have made in your internal memory are revoked, that means your SharedPreference files, Other data files, Database file, Application gets removed automatically by the Android OS.
This is a new marshmallow feature.
Add android:allowBackup="false"
tag inside your object in your app manifest to disable this behaviour.
If android:allowBackup tag clashes with any other library you are using, you should add tools:replace="android:allowBackup"
also.
Upvotes: 3