Original: http://blog.chinaunix.net/uid-26997997-id-3350449.html
In Android, in addition to starting the program from the interface, you can also start the program from the command line, using the command line tool AM.
usage:am [subcommand] [options]
Start an activity:am start [-d]
-d:enable debugging
Send a broadcast intent:am broadcast
Start an INSTRUMENTATION:AM instrument [flags]
-r:print Raw Results (otherwise decode Report_key_streamresult)
-e:set argument to
-p:write Profiling data to
-w:wait for instrumentation to finish before returning
Start Profiling:am profile Start
Stop Profiling:am Profile Stop
Specifications include these flags:
[-A] [-d] [-T]
[-C [-c] ...]
[-e|--es ...]
[--ez ...]
[-e|--ei ...]
[-N] [-F] []
The Startup method is
$ adb shell
$ am Start-n {Package] name}/{package name}. {Activity name}
The entry class of the program can be obtained from each application's Androidmanifest.xml file, with the calculator (calculator) as an example, its
Package= "Com.android.calculator2" ...
The starting method for this calculator (calculator) is:
# AM Start-n com.android.calculator2/com.android.calculator2.calculator
For the helloactivity example project, Androidmanifest.xml looks like this:
Package= "Com.example.android.helloactivity" ...>
The starting method for this is:
# AM Start-n com.example.android.helloactivity/com.example.android.helloactivity.helloactivity
Some of the other application startup commands are as follows:
The calendar is started by:
# AM Start-n com.android.calendar/com.android.calendar.launchactivity
AlarmClock (alarm) is started by:
# AM Start-n Com.android.alarmclock/com.android.alarmclock.alarmclock
The starting methods for music and video are:
# AM Start-n com.android.music/com.android.music.musicbrowseractivity
# AM Start-n com.android.music/com.android.music.videobrowseractivity
# AM Start-n com.android.music/com.android.music.mediaplaybackactivity
The camera startup method is:
# AM Start-n Com.android.camera/com.android.camera.camera
The Browser (browser) Startup method is:
# AM Start-n com.android.browser/com.android.browser.browseractivity
As a general rule, an Android app corresponds to a project. It is worth noting that some projects have multiple activities, while others use a project. For example: In the Android interface, music and video are two applications, but they use the Packages/apps/music project. In this project, the Androidmanifest.xml file contains different activities.
The starting methods for music and video are:
# AM Start-n com.android.music/com.android.music.musicbrowseractivity
# AM Start-n com.android.music/com.android.music.videobrowseractivity
# AM Start-n com.android.music/com.android.music.mediaplaybackactivity
The camera startup method is:
# AM Start-n Com.android.camera/com.android.camera.camera
The Browser (browser) Startup method is:
# AM Start-n com.android.browser/com.android.browser.browseractivity
To start the browser:
Am Start-a android.intent.action.view-d http://www.google.cn/
Dial number:
Am Start-a android.intent.action.call-d tel:10086
Launch Google Map direct to Beijing:
Am Start-a Android.intent.action.VIEW geo:0,0?q=beijing
(go) Android use adb shell command line to launch the app