专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Android

[Share]最近研究Android command,稍微总结一下分享出来,该怎么解决

发布时间:2010-05-30 10:51:59 文章来源:www.iduyao.cn 采编人员:星星草
[Share]最近研究Android command,稍微总结一下分享出来
1. Android支持的linux command不多,在/system/bin下面可以找到,其中大部分都是Android的工具,只有一小部分是linux原有的命令

2. 一些常用的Android命令(这里只总结Android中特有的,其他的linux命令资料就很多了)

a)getprop/watchprops

getprop列出系统的属性,前面十名字,后面是值
# getprop
getprop
[ro.secure]: [0]
[ro.allow.mock.location]: [1]
[ro.debuggable]: [1]
[persist.service.adb.enable]: [1]
[ro.kernel.qemu]: [1]
[ro.kernel.console]: [ttyS0]
[ro.kernel.android.checkjni]: [1]
[ro.kernel.android.qemud]: [ttyS1]
[ro.kernel.android.ndns]: [1]
[ro.factorytest]: [0]
[ro.serialno]: []

watchprosp动态监视这些属性的变化,比如我修改系统的语言为中文,就会打印出:
# watchprops
watchprops
1269420653 persist.sys.language = 'zh'
1269420653 persist.sys.language = 'CN'

b) wipe <system|data|all>
wipe表示清除模拟器或者真机上的数据,比如你的模拟器用了很久,装了很多软件就可以用这个来清除
system表示清除 /system下的数据
data表述清除 /data 下的数据

c) 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>]

am是管理activity的工具,主要有4种用法
am start/stop <INTENT> 表示启动或者停止一个activity,INTENT的参数可以在AndroidManifest.xml中的intent-filter中找到
比如我要打开发送邮件的activity就可以这样写
# am start -a android.intent.action.SEND_MULTIPLE
am start和StartActivity方法是一个作用

am也可以发送一个broadcast,后面的INTENT和上面同
除此之外还可以 start profiling和Instrumentation,这两个还不知怎么用,欢迎大家补充

d)pm
pm就是package manager,可以带下面的参数,因为帮助都说的很清楚了,我就不作解释了
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 list features
  pm path PACKAGE
  pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] PATH
  pm uninstall [-k] PACKAGE
  pm enable PACKAGE_OR_COMPONENT
  pm disable PACKAGE_OR_COMPONENT

The list packages command prints all packages. Options:
  -f: 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. Options:
  -g: organize by group.
  -f: print all information.
  -s: short summary.
  -d: only list dangerous permissions.
  -u: list only the permissions users will see.

The list instrumentation command prints all instrumentations,
or only those that target a specified package. Options:
  -f: see their associated file.

The list features command prints all features of the system.

The path command prints the path to the .apk of a package.
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: