Android(安卓)AM命令行启动程序的方法
在Android中,除了从界面上启动程序之外,还可以从命令行启动程序,使用的是命令行工具am.
usage: am [subcommand] [options]
start an Activity: am start [-D] <INTENT>
-D: enable debugging
send a broadcast Intent: am broadcast <INTENT>
start an Instrumentation: am instrument [flags] <COMPONENT>
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
-e <NAME> <VALUE>: set argument <NAME> to <VALUE>
-p <FILE>: write profiling data to <FILE>
-w: wait for instrumentation to finish before returning
start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop
<INTENT> specifications include these flags:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>] [-f <FLAGS>] [<URI>]
启动的方法为
# am start -n 包(package)名/包名.活动(activity)名称
启动的方法可以从每个应用的AndroidManifest.xml的文件中得到
Music 和 Video(音乐和视频)的启动方法为:
# am start-ncom.android.music/com.android.music.MusicBrowserActivity
# am start-ncom.android.music/com.android.music.VideoBrowserActivity
# am start-ncom.android.music/com.android.music.MediaPlaybackActivity
Camera(照相机)的启动方法为:
# am start -n com.android.camera/com.android.camera.Camera
Browser(浏览器)的启动方法为:
# am start-ncom.android.browser/com.android.browser.BrowserActivity
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/sunrock/archive/2010/06/17/5675067.aspx
更多相关文章
- android 模拟器常用命令
- Android(安卓)程序中哪个 Activity 最先运行
- Android(安卓)Service不被杀死
- Android(安卓)根据一个传入的String选择spinner里面的默认值
- android 一些小功能实现
- Android实现启动页停留几秒然后自动跳转到App首页的方法
- Android选择一段日期
- Android(安卓)getDecorView用途——屏幕截图
- Service Intent must be explicit的解决方法