在android中,除了从界面上启动程序之外,还可以从命令行启动程序,使用的是命令行工具am.
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 ] []
启动的方法为
查看包中每个activity的全路径的方法:
1、安装并启动“固件工具箱”
2、进入“app manager”,显示系统中所有安装程序,长按想通过命令行启动的程序。
3、弹出的窗口中选择”advanced freeze”,该程序所有的activity就会全部显示出来
activity有两种显示格式,一种直接显示全路径,另一种在括号里显示相对路径,相对路径加上包名即是全路径。
上述就是android开发分享Android中使用am命令实现在命令行启动程序详解的全部内容,如果对大家有所用处且需要了解更多关于Android学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!
几个启动指定程序activity的例子
music 和 video(音乐和视频)的启动方法为:
# am start -n com.android.music/com.android.music.videobrowseractivity
# am start -n com.android.music/com.android.music.mediaplaybackactivity
camera(照相机)的启动方法为:
browser(浏览器)的启动方法为:
启动浏览器 :
拨打电话 :
启动 google map 直接定位到北京 :
本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。
ctvol管理联系方式QQ:251552304
本文章地址:https://www.ctvol.com/addevelopment/940948.html