Last active
March 20, 2020 07:09
-
-
Save Ricky-Wilson/b02243a90773b011d2cc394f9bcfbe04 to your computer and use it in GitHub Desktop.
Create a full backup of an android device using ADB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
adb backup -apk -shared -all -f $1 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
packages=`adb shell cmd package list packages | awk -F : '{print $2}' | sort` | |
for p in $packages; do | |
echo "Clearing data from: $p" | |
adb shell pm clear $p | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#packages=`adb shell cmd package list packages | awk -F : '{print $2}' | sort` | |
for file in $1/*.apk | |
do | |
echo "Installing: $file\n" | |
adb install $file | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
packages=`adb shell pm list packages` | |
for p in $packages | |
do | |
echo "Killing $p" | |
adb shell am force-stop $p | |
adb shell am stopservice $p | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
adb shell am kill-all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
adb shell am force-stop `bash infocus.sh` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#----------------------------------------# | |
# List all installed packages on android # | |
#----------------------------------------# | |
adb shell cmd package list packages | awk -F : '{print $2}' | sort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for package in \ | |
$(adb shell pm list packages -3 | tr -d '\r' | sed 's/package://g') | |
do apk=$(adb shell pm path $package | tr -d '\r' | sed 's/package://g') | |
echo "Pulling $apk"; adb pull -p $apk "$package".apk | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################## | |
# Uninstall any package from Android. # | |
######################################## | |
adb shell cmd package uninstall --user 0 $1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment