Android tip: Launch app through adb shell

Please note than I’m using CyanogenMod 7.

First of all you have to know the Intent and Activity of your interest.

The best way to find them I found is to use logcat.

Open a shell

adb shell

Start logcat filtering the needed rows:

logcat | grep 'Starting:'

Start the app you want to launch later in the standard way (use your phone launcher icon).

Take a look to the lines which come from logcat (i.e. launching Shazam):

I/ActivityManager( 205): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.shazam.encore.androidd cmp=com.shazam.encore.android/com.shazam.android.Splash bnds=[365,244][475,362] } from pid 305 I/ActivityManager( 205): Starting: Intent { act=android.intent.action.VIEW flg=0x4000000 cmp=com.shazam.encore.android/com.shazam.android.Home (has extras) } from pid 8096

Now start the app via am:

localhost / # am start -a android.intent.action.MAIN -n com.shazam.encore.android/com.shazam.android.Splash

Look at your phone.

Now you can combine all in one single command:

adb shell 'am start -a android.intent.action.MAIN -n com.shazam.encore.android/com.shazam.android.Splash'

Done.