Question: 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?

Answer: 
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](http://developer.android.com/training/backup/autosyncapi.html). It should be noted that the **default** settings is **true** since 6.0.
I'm pretty sure `SharedPreferences` is always deleted along with the app. In my opinion, the best way to do this would be to write a hidden file (something like ".nameOfFile") onto the SD Card or internal memory and have that contain the preferences as well. You should use SharedPreferences though, it's the Android standard for preference management. You could make it so that the first time your app loads, it checks the SDCard for a hidden file that would have been created last time they opened it. If the file exists, then read in those inputs and store them in the SharedPreferences, if it doesn't, then either the user deleted it or the user has never installed your app before.

This is just one way to do it, and it might not be the most efficient, but I hope it helps!