Last active
August 17, 2016 17:57
-
-
Save matheuseduardo/8d00a0bb266728957e964dc641d07e77 to your computer and use it in GitHub Desktop.
start all packages from android via script
This file contains 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
@echo off | |
:: list all packages (-3 = only thidy parts) | |
adb shell 'pm list packages -3 > /sdcard/packages.txt'; | |
:: get file | |
adb pull -p "/sdcard/packages.txt" "packages.txt"; |
This file contains 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 packages (-3 = only thidy parts) | |
adb shell 'pm list packages -3 > /sdcard/packages.txt'; | |
# get file | |
adb pull -p "/sdcard/packages.txt" "packages.txt"; # <~ maybe not work on windows w/ cygwin | |
filelines=`cat packages.txt | cut -c 9-`; # removing "package:" (8 chars) | |
totalapps=`wc -l < packages.txt`; | |
countapps=0; | |
for line in $filelines ; do | |
countapps=`expr $countapps + 1` | |
echo "inciando pacote ($countapps/$totalapps): $line"; | |
adb shell "monkey -p $line -c android.intent.category.LAUNCHER 1;" | |
sleep 4; | |
adb shell "input keyevent 4; input keyevent 4;" # 2 times back button | |
sleep 0.5; | |
adb shell "input keyevent 3"; # then home | |
sleep 0.5; | |
echo -e "\n" | |
done |
This file contains 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 | |
filename=$1; | |
filelines=`cat $filename`; | |
totalapps=`wc -l < $filename`; | |
countapps=0; | |
for line in $filelines ; do | |
countapps=`expr $countapps + 1` | |
echo "inciando pacote ($countapps/$totalapps): $line"; | |
adb shell "monkey -p $line -c android.intent.category.LAUNCHER 1;" | |
sleep 4; | |
adb shell "input keyevent 4; input keyevent 4;" # 2 times back button | |
sleep 0.5; | |
adb shell "input keyevent 3"; # then home | |
sleep 0.5; | |
echo -e "\n" | |
done | |
echo -e "\n"; | |
adb shell input keyevent 26; | |
echo "fim! :)"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment