Android自动化测试之MonkeyRunner-之getProperty、getSystemProperty
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 inTable 1. Property variable names at the end of this topic. |
Returns
· The value of the variable. The data format varies according to the variable requested.
object getSystemProperty (string key)
Synonym for getProperty().
Arguments
| key | The name of the system environment variable. The available variable names are listed inTable 1. Property Variable Names. |
Returns
· The value of the variable. The data format varies according to the variable requested.
| Property Group | Property | Description | Notes |
| build | board | Code name for the device's system board | See Build |
| 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 DisplayMetrics 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. Seedensity 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. Seecomp.package 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 SystemClock 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. |
本文介绍如何使用MonkeyRunner的getProperty和getSystemProperty方法来获取Android设备的系统环境变量。这些方法可以返回诸如设备型号、屏幕尺寸等重要信息。
2624

被折叠的 条评论
为什么被折叠?



