-
-
Save blundell/7c0c3bb17898b28fe8122b0dc230af50 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
sp="/-\|" | |
sc=0 | |
spin() { | |
printf "\b${sp:sc++:1}" | |
((sc==${#sp})) && sc=0 | |
} | |
endspin() { | |
printf "\r" | |
} | |
echo "Uninstalling Android Things category apps" | |
# This script is for > DP8 | |
# for < DP8 you need to replace android.intent.category.HOME with android.intent.category.IOT_LAUNCHER on line 25 | |
spin | |
userInstalledPackages=( $(adb shell pm list packages -3 | sed -e "s/^"package:"//" ) ) | |
iotPackages=() | |
for userPackage in "${userInstalledPackages[@]}" | |
do | |
: | |
spin | |
categoryLauncherText=$( adb shell pm dump $userPackage | grep "android.intent.category.HOME") | |
if [ -n "${categoryLauncherText}" ]; then | |
iotPackages+=(${userPackage}) | |
fi | |
done | |
endspin | |
for iotPackage in "${iotPackages[@]}" | |
do | |
: | |
echo "Uninstalling $iotPackage" | |
adb uninstall $iotPackage | |
done | |
echo "Complete" |
Perfect! Works great. Thank you... :)
Lifesaver!
May I know where you are running this script. Is it from the terminal of Android Studio? Or do you use serial console access to run it on the device? BTW, where's the best place to put default startup scripts? Thx
Terrific..thanks!!
@arvindpdmn sorry I missed the notification. Yes, run this from a terminal if you only have one device connected it will use adb
to talk to it (also there is a terminal window inside Android Studio you could use).
Default startup scripts (I assume you mean on a device) - Android Things runs at a higher level of abstraction than having to run startup scripts. Your best bet is to put some code into your Application
class onCreate
method (googling this term will help you)
Great idea, thank you!
This is awesome!