android adb shell script - how to pull all sharedpreferences -
i need run script in debug mode pull sharedpreferences folder. research can pull debug builds. tried non-rooted phone sharedpreferences this:
$adb shell $adb run-as mypackagename then able traverse /data/data/mypackagename/shared_prefs
but i'd able put in script. can call adb pull outside adb shell. how can shared_prefs entire folder pulled out of normal non-rooted device on debug application ? there must way because how facebook setho doing it ?
this question retrieving sharedpreferences not database retrieval.
i created following shell script
#!/bin/bash pname=$1 if [ -z "${pname}" ]; echo "please enter package name" exit 1 fi adb shell "run-as $pname chmod 776 shared_prefs" adb pull /data/data/$pname/shared_prefs ./${pname}_shared_prefs adb shell "run-as $pname chmod 771 shared_prefs" name pullsharedprefs.sh (or whatever want) , terminal run command:
chmod +x pullsharedprefs.sh ./pullsharedprefs.sh some.package.name shared_prefs pulled current working directory , named {package-name}_shared_prefs
tested using genymotion (android 5.1.1)
Comments
Post a Comment