Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15336828
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类:

2010-09-27 10:45:07

Android AM命令行启动程序的方法 

在Android中,除了从界面上启动程序之外,还可以从命令行启动程序,使用的是命令行工具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 ] []

启动的方法为

# 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


阅读(1878) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~