Now that we can Examining sqlite3 Databases from a Remote Shell, is it possible to examine SharedPreferences from adb shell? Since it would be much more convenient to examine an
I am using this convenient one-liner to pull, edit in vim, and push shared preferences for an app:
APP_ID=com.myapp; adb pull /data/data/${APP_ID}/shared_prefs/${APP_ID}_preferences.xml /tmp/${APP_ID}_preferences.xml && vim /tmp/${APP_ID}_preferences.xml && adb push /tmp/${APP_ID}_preferences.xml /data/data/${APP_ID}/shared_prefs/
Just set APP_ID
to your application id.
Note that this assumes you are using the default file name for shared preferences, as obtained from PreferenceManager.getDefaultSharedPreferences(context)
. Also, ADB needs to be running in root mode: adb root