Android: Useful adb shell commands

While I am developing on Android there are some commands the android shell offers, that I just love. They are very helpful for debugging or testing some things. Let me share my favorites with you. If you have other ones you use often, please tell me those in the comments.

Launch intents

// starts the facebook app showing the inbox screen by using the Uri for that
adb shell am start -a android.intent.action.VIEW -d facebook://facebook.com/inbox
// open a vcard file from sdcard (will open contacts app :) )
adb shell am start -a android.intent.action.VIEW -d file:///sdcard/me.vcard -t text/x-vcard
// open an application to get content (in this case to get a jpeg picture)
adb shell am start -a android.intent.action.GET_CONTENT -t image/jpeg 

Such commands in the adb shell are very usefull to launch intents. Just run adb shell am to see what other options you have and start playing around.

Show info about running activities (I use it to see the activity stack of my app)

adb shell dumpsys activity

This will dump out a lot of information like: Sticky broadcasts, Activity stack, Running processes.

Subscribe to pboos

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe