Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Uninstall all apps on an Android Device that have the intent-filter category IOT_LAUNCHER
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
userInstalledPackages=( $(adb shell pm list packages -3 | sed -e "s/^"package:"//" ) )
for userPackage in "${userInstalledPackages[@]}"
categoryLauncherText=$( adb shell pm dump $userPackage | grep "android.intent.category.HOME")
if [ -n "${categoryLauncherText}" ]; then
for iotPackage in "${iotPackages[@]}"
echo "Uninstalling $iotPackage"
adb uninstall $iotPackage
echo "Complete"
Copy link

blundell commented Jan 4, 2017

When you have ran multiple apps on an Android Things device and then boot the device it won't start any app but instead go to the intent chooser, for the user to select one of these apps to start. Therefore if you have no screen attached - nothing happens.

This script uninstalls all apps that you have installed (searching for intent category IOT_LAUNCHER) so that you can start again afresh.

screen shot 2017-01-04 at 9 01 53 pm

Copy link

mwolfson commented Apr 26, 2017

This is awesome!

Copy link

jdestremps commented Jul 25, 2017

Perfect! Works great. Thank you... :)

Copy link

nekdenis commented Aug 3, 2017


Copy link

arvindpdmn commented Jan 3, 2018

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

Copy link

n8ebel commented Feb 3, 2018


Copy link

blundell commented Apr 18, 2018

@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)

Copy link

davemckelvie commented Jul 8, 2018

Great idea, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment