I use the internal shared preferences to store key/values on an Android device. I wanted to have a look at this data directly using a file explorer but I cannot find where it is stored physically. Most apps have an own directory on Android/data but there is no folder for my Flutter app.
Do you have an idea where the data is stored locally?
Thanks in advance.
Edit (To make my problem clearer):
I need to access this data from outside app. A user of my app is not able to start the app anymore for some reasons. I want him to send me the internal data for debugging purposes.
So is it possible to fetch the related files in any way without the app self?
2
Answers
On native android its stored inside the data folder. The path will be something like
On Flutter projects its stored inside the same folder but with fixed name
FlutterSharedPreferences.xml
Something like
Edited in response of updated question – 05/01/2023
If your app is relying heavily on sharedpreferences then I don’t think there is a way to get it from outside your app. But I have an idea which you can try.
Try this package
https://pub.dev/packages/flutter_logs
.This can create log files in file system. If your app is currently crashing after opening you can try to put this log code to write down the sharedpreferences inside the log file. Then you can setup some code to send the logs by email.
But there are few catches in this approach.
I suggest you to implement this anyhow as in future you might get stuck in similar situation if you are relying on sharedpreferences.
Hope this helps.
SharedPreferences are stored in an xml file in the app data folder, i.e.
You can access these from Device File Explorer Tab inside the Android Studio IDE on the right side :