在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 -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

 

Camera(照相机)的启动方法为:

# am start -n com.android.camera/com.android.camera.Camera

 

Browser(浏览器)的启动方法为:

# am start -n com.android.browser/com.android.browser.BrowserActivity

 

启动浏览器 :

am start -a android.intent.action.VIEW -d  http://www.google.cn/

 

拨打电话 :

am start -a android.intent.action.CALL -d tel:10086

 

启动 google map 直接定位到北京 :

am start -a android.intent.action.VIEW geo:0,0?q=beijing

更多相关文章

  1. 浅谈Java中Collections.sort对List排序的两种方法
  2. Python list sort方法的具体使用
  3. python list.sort()根据多个关键字排序的方法实现
  4. android--系统路径获取
  5. 安卓开发模拟器运行时报错原因以及解决方法
  6. android回到桌面的方法
  7. android开机自启动的后台Service的实现
  8. Android安装卸载程序具体操作方法解析
  9. Android中的Context理解

随机推荐

  1. Android-在应用中使用拖拽教程
  2. CyclicBarrier
  3. Android中Java与web通信
  4. android的技术层次
  5. Android知识点回顾
  6. Android根据联系人姓名首字符顺序读取通
  7. android不是内部或外部命令,也不是可运行
  8. Graphics architecture
  9. 为什么iOS平台更容易吸引开发者?
  10. TextView中的文字添加阴影效果及Style的