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命令的参数介绍如下:
- 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:扩展存储设备。
-
顶