Androidampm命令⽤法am命令的参数介绍:
usage: am [subcommand] [options]
start an Activity: am start [-D] <INTENT>
-D: enable debugging
send a broadcast Intent: am broadcast <INTENT>
start an Instrumentation: am instrument [flags] <COMPONENT>
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
-e <NAME> <VALUE>: set argument <NAME> to <VALUE>
-p <FILE>: write profiling data to <FILE>
-w: wait for instrumentation to finish before returning
start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop
<INTENT> specifications include these flags:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>] [-f <FLAGS>] [<URI>]
tips:你也可以在终端下输⼊adb shell am 查看更多使⽤⽅法
具体使⽤⽅法:
am start -n 包(package)名/包名.活动(activity)名称
启动的⽅法可以从每个应⽤的l的⽂件中得到
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.CALL -d tel:10086
启动 google map 直接定位到北京 :
am start -a android.intent.action.VIEW geo:0,0?q=beijing
安卓am命令有很多个参数及使⽤⽅法,具体可参考官⽅⽹站:
==================================================
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]
安卓intent用法pm path PACKAGE
pm install [-l] [-r] PATH
pm uninstall [-k] PACKAGE
pm enable PACKAGE_OR_COMPONENT
pm disable PACKAGE_OR_COMPONENT
The 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.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.locationwork
feature:android.hardware.microphone
feature:android.hardware.sensor.accelerometer
feature:android.hardware.sensorpass
feature:uchscreen
feature:android.hardware.wifi
1.5:列出指定包名的 associated ⽂件 (APK存档⽂件) 所在:
例如:
pm path st
package:/mnt/asec/st-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 st
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:扩展存储设备。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论