博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android自动化工具Monkeyrunner使用(四)
阅读量:4051 次
发布时间:2019-05-25

本文共 3298 字,大约阅读时间需要 10 分钟。

     本章开始介绍下MonkeyrunnerAPI, 以便了解其具体的使用。

object getProperty (string key) 根据系统属性获取当前系统属性对象

Given the name of a system environment variable, returns its value for this device. The available variable names are listed in the of this method.

object getProperty (string key)

Given the name of a system environment variable, returns its value for this device.

Arguments
key The name of the system environment variable. The available variable names are listed in at the end of this topic.
Returns
  • The value of the variable. The data format varies according to the variable requested.

E.g. 获取当前设备的width

device.startActivity(component=runComponent)

width = device.getProperty('display.width')

pring width

以下为key的具体内容:

Property Group Property Description Notes
build board Code name for the device's system board See
brand The carrier or provider for which the OS is customized.
device The device design name.
fingerprint A unique identifier for the currently-running build.
host  
ID A changelist number or label.
model The end-user-visible name for the device.
product The overall product name.
tags Comma-separated tags that describe the build, such as "unsigned" and "debug".
type The build type, such as "user" or "eng".
user  
CPU_ABI The name of the native code instruction set, in the form CPU type plus ABI convention.
manufacturer The product/hardware manufacturer.
version.incremental The internal code used by the source control system to represent this version of the software.
version.release The user-visible name of this version of the software.
version.sdk The user-visible SDK version associated with this version of the OS.
version.codename The current development codename, or "REL" if this version of the software has been released.
display width The device's display width in pixels. See for details.
height The device's display height in pixels.
density The logical density of the display. This is a factor that scales DIP (Density-Independent Pixel) units to the device's resolution. DIP is adjusted so that 1 DIP is equivalent to one pixel on a 160 pixel-per-inch display. For example, on a 160-dpi screen, density = 1.0, while on a 120-dpi screen, density = .75.

The value does not exactly follow the real screen size, but is adjusted to conform to large changes in the display DPI. See for more details.

am.current package The Android package name of the currently running package. The am.current keys return information about the currently-running Activity.
action The current activity's action. This has the same format as the name attribute of the action element in a package manifest.
comp.class The class name of the component that started the current Activity. See for more details.
The package name of the component that started the current Activity. A component is specified by a package name and the name of class that the package contains.
data The data (if any) contained in the Intent that started the current Activity.
categories The categories specified by the Intent that started the current Activity.
clock realtime The number of milliseconds since the device rebooted, including deep-sleep time. See for more information.
uptime The number of milliseconds since the device rebooted, not including deep-sleep time
millis current time since the UNIX epoch, in milliseconds.

转载地址:http://rwjci.baihongyu.com/

你可能感兴趣的文章
android中对于非属性动画的整理
查看>>
一个简单的TabLayout的使用
查看>>
ReactNative使用Redux例子
查看>>
Promise的基本使用
查看>>
coursesa课程 Python 3 programming 统计文件有多少单词
查看>>
coursesa课程 Python 3 programming 输出每一行句子的第三个单词
查看>>
Returning a value from a function
查看>>
coursesa课程 Python 3 programming Functions can call other functions 函数调用另一个函数
查看>>
coursesa课程 Python 3 programming The while Statement
查看>>
course_2_assessment_6
查看>>
coursesa课程 Python 3 programming course_2_assessment_7 多参数函数练习题
查看>>
coursesa课程 Python 3 programming course_2_assessment_8 sorted练习题
查看>>
在unity中建立最小的shader(Minimal Shader)
查看>>
1.3 Debugging of Shaders (调试着色器)
查看>>
关于phpcms中模块_tag.class.php中的pc_tag()方法的含义
查看>>
vsftp 配置具有匿名登录也有系统用户登录,系统用户有管理权限,匿名只有下载权限。
查看>>
linux安装usb wifi接收器
查看>>
多线程使用随机函数需要注意的一点
查看>>
getpeername,getsockname
查看>>
让我做你的下一行Code
查看>>