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 ] []tips:你也可以在终端下输入adb shell am 查看更多使用方法
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25

具体使用方法:

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.baidu.com/

拨打电话 : 
am start -a android.intent.action.CALL -d tel:10086

启动 google map 直接定位到北京 : 
am start -a android.intent.action.VIEW geo:0,0?q=beijing

安卓am命令有很多个参数及使用方法,具体可参考官方网站:Android Debug Bridge

==================================================

pm命令的参数介绍如下:

usage: pm [list|path|install|uninstall]        pm list packages [-f]        pm list permission-groups        pm list permissions [-g] [-f] [-d] [-u] [GROUP]        pm list instrumentation [-f] [TARGET-PACKAGE]        pm path PACKAGE        pm install [-l] [-r] PATH        pm uninstall [-k] PACKAGE        pm enable PACKAGE_OR_COMPONENT        pm disable PACKAGE_OR_COMPONENTThe list packages command prints all packages.  Use the -f option to see their associated file.The list permission-groups command prints all known permission groups.The list permissions command prints all known permissions, optionally only those in GROUP.  Use the -g option to organize by group.  Use the -f option to print all information.  Use the -s option for a short summary.  Use the -d option to only list dangerous permissions.  Use the -u option to list only the permissions users will see.The list instrumentation command prints all instrumentations, or only those that target a specified package.  Use the -f option to see their associated file.The path command prints the path to the .apk of a package.The install command installs a package to the system.  Use the -l option to install the package with FORWARD_LOCK. Use the -r option to reinstall an exisiting app, keeping its data.The uninstall command removes a package from the system. Use the -k option to keep the data and cache directories around after the package removal.tips:你也可以在终端下输入adb shell pm 查看更多使用方法
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

具体使用方法:

1.1:察看已安装的包: 
pm list package 
此时则显示所有已经安装的包名。

pm list package -f 
也显示associated文件所在目录(即保存的APK文件)

1.2:察看已知的权限组: 
pm list permission-groups

1.3:察看所有已知的权限: 
pm list permissions

1.4:列出所有硬件相关信息: 
pm list features

结果通常类似: 
feature:reqGlEsVersion=0x20000 
feature:android.hardware.bluetooth 
feature:android.hardware.camera 
feature:android.hardware.location 
feature:android.hardware.location.network 
feature:android.hardware.microphone 
feature:android.hardware.sensor.accelerometer 
feature:android.hardware.sensor.compass 
feature:android.hardware.touchscreen 
feature:android.hardware.wifi

1.5:列出指定包名的 associated 文件 (APK存档文件) 所在: 
例如: 
pm path com.cai.test 
package:/mnt/asec/com.cai.test-1/test.apk

1.6: 安装APK: 
pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] PATH

PATH 指 APK文件绝对路径和文件名。

例如: 
pm install /data/test.apk

这几个参数很有用: 
-r: 安装一个已经安装的APK,保持其数据不变。 
-i:指定安装的包名。(没试出来) 
-s: 安装到SDCard上。 
-f: 安装到内部Flash上。

1.6:卸载APK: 
pm uninstall 包名。 
例如: 
pm uninstall com.cai.test

1.7: 得到和设置缺省安装位置: 
The getInstallLocation command gets the current install location 
0 [auto]: Let system decide the best location 
1 [internal]: Install on internal device storage 
2 [external]: Install on external media 
The setInstallLocation command changes the default install location 
0 [auto]: Let system decide the best location 
1 [internal]: Install on internal device storage 
2 [external]: Install on external media

pm getInstallLocation 
得到缺省的安装位置。

设置: 
pm setInstallLocation <0|1|2>

0: 自动。 
1:内部Flash。 
2:扩展存储设备。

更多相关文章

  1. 【Android】使用Git控制Android程序的gitignore文件
  2. Android 将图片文件,转成Bitmap
  3. springmvc服务端+android客户端的文件上传
  4. android 中生成XML文件的代码
  5. Android中pull解析XML文件
  6. Android获得文件夹大小
  7. android头文件路径
  8. Android上传文件到Django服务器

随机推荐

  1. android百度地图开发总结
  2. Android(安卓)Notes 之 自定义View(1) 之
  3. Android系统安全大纲
  4. Android(安卓)ListView中 每一项都有不同
  5. [Android进阶]Android(安卓)开发最佳实践
  6. Android(安卓)禁止屏幕旋转 & 旋转屏幕时
  7. Android(安卓)依赖库的使用
  8. 【Medium 万赞好文】ViewModel 和 LIveDa
  9. Activity class {package/class} does no
  10. Activity中的onSaveInstanceState()解析