6.2.0 - 重新设计及编写项目文档; 新增多语言适配; 丰富控件选择器功能; 优化夜间模式适配等
This commit is contained in:
@@ -1,87 +1,141 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Device | Auto.js 4.1.0 文档</title>
|
||||
<link rel="stylesheet" href="assets/fonts.css">
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
<link rel="stylesheet" href="assets/sh.css">
|
||||
<link rel="canonical" href="https://nodejs.org/api/device.html">
|
||||
<meta charset="utf-8">
|
||||
<title>设备 (Device) | AutoJs6 文档 - 6.2.0</title>
|
||||
<link rel="stylesheet" href="assets/fonts.css">
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
<link rel="stylesheet" href="assets/sh.css">
|
||||
<link rel="canonical" href="https://nodejs.org/api/device.html">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="viewport" content="user-scalable=no">
|
||||
</head>
|
||||
<body class="alt apidoc" id="api-section-device">
|
||||
<div id="content" class="clearfix">
|
||||
<div id="content" class="clearfix">
|
||||
<div id="column2" class="interior">
|
||||
<div id="intro" class="interior">
|
||||
<a href="/" title="返回首页">
|
||||
Auto.js
|
||||
</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a class="nav-documentation" href="documentation.html">关于本文档</a></li>
|
||||
<li><a class="nav-http-www-w3school-com-cn-js-pro_js_syntax-asp" href="http://www.w3school.com.cn/js/pro_js_syntax.asp">W3CSchool - ECMAScript教程</a></li>
|
||||
<li><a class="nav-http-es6-ruanyifeng-com-README" href="http://es6.ruanyifeng.com/#README">阮一峰 - ECMAScript 6教程</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<div id="intro" class="interior">
|
||||
<a href="/" title="返回首页">
|
||||
AutoJs6
|
||||
</a>
|
||||
</div>
|
||||
<ul>
|
||||
<li><a class="nav-overview" href="overview.html">Overview - 综述</a></li>
|
||||
<li><a class="nav-qa" href="qa.html">Q&A - 常见问题</a></li>
|
||||
<li><a class="nav-app" href="app.html">App - 应用</a></li>
|
||||
<li><a class="nav-console" href="console.html">Console - 控制台</a></li>
|
||||
<li><a class="nav-coordinates-based-automation" href="coordinates-based-automation.html">CoordinatesBasedAutomation - 基于坐标的操作</a></li>
|
||||
<li><a class="nav-device active" href="device.html">Device - 设备</a></li>
|
||||
<li><a class="nav-dialogs" href="dialogs.html">Dialogs - 对话框</a></li>
|
||||
<li><a class="nav-engines" href="engines.html">Engines - 脚本引擎</a></li>
|
||||
<li><a class="nav-events" href="events.html">Events - 事件与监听</a></li>
|
||||
<li><a class="nav-floaty" href="floaty.html">Floaty - 悬浮窗</a></li>
|
||||
<li><a class="nav-files" href="files.html">Files - 文件系统</a></li>
|
||||
<li><a class="nav-globals" href="globals.html">Globals - 一般全局函数</a></li>
|
||||
<li><a class="nav-http" href="http.html">Http - HTTP</a></li>
|
||||
<li><a class="nav-images" href="images.html">Images - 图片与图色处理</a></li>
|
||||
<li><a class="nav-keys" href="keys.html">Keys - 按键模拟</a></li>
|
||||
<li><a class="nav-media" href="media.html">Media - 多媒体</a></li>
|
||||
<li><a class="nav-modules" href="modules.html">Modules - 模块</a></li>
|
||||
<li><a class="nav-widgets-based-automation" href="widgets-based-automation.html">WidgetsBasedAutomation - 基于控件的操作</a></li>
|
||||
<li><a class="nav-sensors" href="sensors.html">Sensors - 传感器</a></li>
|
||||
<li><a class="nav-shell" href="shell.html">Shell - Shell命令</a></li>
|
||||
<li><a class="nav-storages" href="storages.html">Storages - 本地存储</a></li>
|
||||
<li><a class="nav-threads" href="threads.html">Threads - 多线程</a></li>
|
||||
<li><a class="nav-timers" href="timers.html">Timers - 定时器</a></li>
|
||||
<li><a class="nav-ui" href="ui.html">UI - 用户界面</a></li>
|
||||
<li><a class="nav-https-developer-mozilla-org-zh-CN-docs-Mozilla-Projects-Rhino-Scripting_Java" href="https://developer.mozilla.org/zh-CN/docs/Mozilla/Projects/Rhino/Scripting_Java">Work with Java - 调用Java API</a></li>
|
||||
<li><a class="nav-documentation" href="documentation.html">About - 关于文档</a></li>
|
||||
<li><a class="nav-progress" href="progress.html">Progress - 完善进度</a></li>
|
||||
<li><a class="nav-changelog" href="changelog.html">Changelog - 更新日志</a></li>
|
||||
<li><a class="nav-qa" href="qa.html">Q&A - 疑难解答</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<li><a class="nav-https-github-com-hyb1996-NoRootScriptDroid" href="https://github.com/hyb1996/NoRootScriptDroid">GitHub项目 & Issue提交</a></li>
|
||||
<li><a class="nav-http-autojs-org" href="http://autojs.org">Auto.js交流社区</a></li>
|
||||
<li><a class="nav-https-developer-mozilla-org-zh-CN-docs-Web-JavaScript-" href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/">MDN - JavaScript 基础</a></li>
|
||||
<li><a class="nav-https-zh-javascript-info-" href="https://zh.javascript.info/">JavaScript.info - JavaScript 教程</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<li><a class="nav-global" href="global.html">Global - 全局对象</a></li>
|
||||
<li><a class="nav-automator" href="automator.html">Automator - 自动化</a></li>
|
||||
<li><a class="nav-autojs" href="autojs.html">AutoJs6 - 本体应用</a></li>
|
||||
<li><a class="nav-app" href="app.html">App - 通用应用</a></li>
|
||||
<li><a class="nav-color" href="color.html">Color - 颜色</a></li>
|
||||
<li><a class="nav-image" href="image.html">Image - 图像</a></li>
|
||||
<li><a class="nav-keys" href="keys.html">Keys - 按键</a></li>
|
||||
<li><a class="nav-device active" href="device.html">Device - 设备</a></li>
|
||||
<li><a class="nav-storages" href="storages.html">Storage - 储存</a></li>
|
||||
<li><a class="nav-files" href="files.html">File - 文件</a></li>
|
||||
<li><a class="nav-engines" href="engines.html">Engine - 引擎</a></li>
|
||||
<li><a class="nav-tasks" href="tasks.html">Task - 任务</a></li>
|
||||
<li><a class="nav-modules" href="modules.html">Module - 模块</a></li>
|
||||
<li><a class="nav-plugins" href="plugins.html">Plugins - 插件</a></li>
|
||||
<li><a class="nav-console" href="console.html">Console - 控制台</a></li>
|
||||
<li><a class="nav-shell" href="shell.html">Shell</a></li>
|
||||
<li><a class="nav-media" href="media.html">Media - 多媒体</a></li>
|
||||
<li><a class="nav-sensors" href="sensors.html">Sensor - 传感器</a></li>
|
||||
<li><a class="nav-recorder" href="recorder.html">Recorder - 记录器</a></li>
|
||||
<li><a class="nav-timers" href="timers.html">Timer - 定时器</a></li>
|
||||
<li><a class="nav-threads" href="threads.html">Thread - 线程</a></li>
|
||||
<li><a class="nav-continuation" href="continuation.html">Continuation - 协程</a></li>
|
||||
<li><a class="nav-events" href="events.html">Event - 事件监听</a></li>
|
||||
<li><a class="nav-dialogs" href="dialogs.html">Dialog - 对话框</a></li>
|
||||
<li><a class="nav-floaty" href="floaty.html">Floaty - 悬浮窗</a></li>
|
||||
<li><a class="nav-canvas" href="canvas.html">Canvas - 画布</a></li>
|
||||
<li><a class="nav-ui" href="ui.html">UI - 用户界面</a></li>
|
||||
<li><a class="nav-web" href="web.html">Web - 万维网</a></li>
|
||||
<li><a class="nav-http" href="http.html">HTTP</a></li>
|
||||
<li><a class="nav-base64" href="base64.html">Base64</a></li>
|
||||
<li><a class="nav-crypto" href="crypto.html">Crypto - 密文</a></li>
|
||||
<li><a class="nav-i18n" href="i18n.html">Internationalization - 国际化</a></li>
|
||||
<li><a class="nav-e4x" href="e4x.html">E4X</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<li><a class="nav-glossaries" href="glossaries.html">Glossaries - 术语</a></li>
|
||||
<li><a class="nav-exceptions" href="exceptions.html">Exceptions - 异常</a></li>
|
||||
<li><a class="nav-intentType" href="intentType.html">Intent - 意图</a></li>
|
||||
<li><a class="nav-runtime" href="runtime.html">Runtime - 运行时</a></li>
|
||||
<li><a class="nav-context" href="context.html">Context - 上下文</a></li>
|
||||
<li><a class="nav-activity" href="activity.html">Activity - 活动</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<li><a class="nav-dataTypes" href="dataTypes.html">Data Types - 数据类型</a></li>
|
||||
<li><a class="nav-uiSelectorType" href="uiSelectorType.html">UiSelector - 选择器</a></li>
|
||||
<li><a class="nav-uiObjectType" href="uiObjectType.html">UiObject - 控件节点</a></li>
|
||||
<li><a class="nav-uiObjectCollectionType" href="uiObjectCollectionType.html">UiObjectCollection - 控件集合</a></li>
|
||||
<li><a class="nav-uiObjectActionsType" href="uiObjectActionsType.html">UiObjectActions - 控件节点行为</a></li>
|
||||
<li><a class="nav-appType" href="appType.html">App - 应用枚举类</a></li>
|
||||
<li><a class="nav-versionType" href="versionType.html">Version - 版本工具类</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<li><a class="nav-polyfill" href="polyfill.html">Polyfill - 代码填泥</a></li>
|
||||
<li><a class="nav-arrayx" href="arrayx.html">Arrayx - Array 扩展</a></li>
|
||||
<li><a class="nav-numberx" href="numberx.html">Numberx - Number 扩展</a></li>
|
||||
<li><a class="nav-mathx" href="mathx.html">Mathx - Math 扩展</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<li><a class="nav-scriptingJava" href="scriptingJava.html">Scripting Java - 脚本化 Java</a></li>
|
||||
<li><a class="nav-apiLevel" href="apiLevel.html">Android API Level - 安卓 API 级别</a></li>
|
||||
<li><a class="nav-colorTable" href="colorTable.html">Color Table - 颜色列表</a></li>
|
||||
</ul>
|
||||
<div class="line"></div>
|
||||
|
||||
<ul>
|
||||
<li><a class="nav-https-github-com-SuperMonster003-AutoJs6-" href="https://github.com/SuperMonster003/AutoJs6/">GitHub - 应用项目地址</a></li>
|
||||
<li><a class="nav-https-github-com-SuperMonster003-AutoJs6-Documentation" href="https://github.com/SuperMonster003/AutoJs6-Documentation">GitHub - 文档项目地址</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="column1" data-id="device" class="interior">
|
||||
<header>
|
||||
<h1>Auto.js 4.1.0 文档</h1>
|
||||
<div id="gtoc">
|
||||
<p>
|
||||
<a href="index.html" name="toc">索引</a> |
|
||||
<a href="all.html">查看全部</a>
|
||||
</p>
|
||||
</div>
|
||||
<hr>
|
||||
</header>
|
||||
<header>
|
||||
<h1>AutoJs6 文档 - 6.2.0</h1>
|
||||
<div id="gtoc">
|
||||
<p class="index">
|
||||
<a href="index.html" name="toc">索引</a> |
|
||||
<a href="all.html">查看全部</a>
|
||||
</p>
|
||||
</div>
|
||||
<hr>
|
||||
</header>
|
||||
|
||||
<div id="toc">
|
||||
<h2>目录</h2>
|
||||
<ul>
|
||||
<li><span class="stability_2"><a href="#device_device">Device</a></span><ul>
|
||||
<div id="toc">
|
||||
<h2>目录</h2>
|
||||
<ul>
|
||||
<li><span class="stability_undefined"><a href="#device_device">设备 (Device)</a></span><ul>
|
||||
<li><span class="stability_undefined"><a href="#device_device_width">device.width</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_height">device.height</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_buildid">device.buildId</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_broad">device.broad</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_brand">device.brand</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_device">device.device</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_deivce_model">deivce.model</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_model">device.model</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_product">device.product</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_bootloader">device.bootloader</a></span></li>
|
||||
<li><span class="stability_undefined"><a href="#device_device_hardware">device.hardware</a></span></li>
|
||||
@@ -125,268 +179,277 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="apicontent">
|
||||
<h1>Device<span><a class="mark" href="#device_device" id="device_device">#</a></span></h1>
|
||||
<div class="api_stability api_stability_2"><a href="documentation.html#documentation_stability_index">Stability: 2</a> - Stable</div><p>device模块提供了与设备有关的信息与操作,例如获取设备宽高,内存使用率,IMEI,调整设备亮度、音量等。</p>
|
||||
<p>此模块的部分函数,例如调整音量,需要"修改系统设置"的权限。如果没有该权限,会抛出<code>SecurityException</code>并跳转到权限设置界面。</p>
|
||||
<div id="apicontent">
|
||||
<h1>设备 (Device)<span><a class="mark" href="#device_device" id="device_device">#</a></span></h1>
|
||||
<hr>
|
||||
<p style="font: italic 1em sans-serif; color: #78909C">此章节待补充或完善...</p>
|
||||
<p style="font: italic 1em sans-serif; color: #78909C">Marked by SuperMonster003 on Oct 22, 2022.</p>
|
||||
|
||||
<hr>
|
||||
<p>device模块提供了与设备有关的信息与操作, 例如获取设备宽高, 内存使用率, IMEI, 调整设备亮度、音量等.</p>
|
||||
<p>此模块的部分函数, 例如调整音量, 需要"修改系统设置"的权限. 如果没有该权限, 会抛出<code>SecurityException</code>并跳转到权限设置界面.</p>
|
||||
<h2>device.width<span><a class="mark" href="#device_device_width" id="device_device_width">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
|
||||
</ul>
|
||||
</div><p>设备屏幕分辨率宽度。例如1080。</p>
|
||||
</div><p>设备屏幕分辨率宽度. 例如1080.</p>
|
||||
<h2>device.height<span><a class="mark" href="#device_device_height" id="device_device_height">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
|
||||
</ul>
|
||||
</div><p>设备屏幕分辨率高度。例如1920。</p>
|
||||
</div><p>设备屏幕分辨率高度. 例如1920.</p>
|
||||
<h2>device.buildId<span><a class="mark" href="#device_device_buildid" id="device_device_buildid">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>Either a changelist number, or a label like "M4-rc20".</p>
|
||||
<p>修订版本号,或者诸如"M4-rc20"的标识。</p>
|
||||
<p>修订版本号, 或者诸如"M4-rc20"的标识.</p>
|
||||
<h2>device.broad<span><a class="mark" href="#device_device_broad" id="device_device_broad">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The name of the underlying board, like "goldfish".</p>
|
||||
<p>设备的主板(?)型号。</p>
|
||||
<p>设备的主板(?)型号.</p>
|
||||
<h2>device.brand<span><a class="mark" href="#device_device_brand" id="device_device_brand">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The consumer-visible brand with which the product/hardware will be associated, if any.</p>
|
||||
<p>与产品或硬件相关的厂商品牌,如"Xiaomi", "Huawei"等。</p>
|
||||
<p>与产品或硬件相关的厂商品牌, 如"Xiaomi", "Huawei"等.</p>
|
||||
<h2>device.device<span><a class="mark" href="#device_device_device" id="device_device_device">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The name of the industrial design.</p>
|
||||
<p>设备在工业设计中的名称。</p>
|
||||
<h2>deivce.model<span><a class="mark" href="#device_deivce_model" id="device_deivce_model">#</a></span></h2>
|
||||
<p>设备在工业设计中的名称.</p>
|
||||
<h2>device.model<span><a class="mark" href="#device_device_model" id="device_device_model">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The end-user-visible name for the end product.</p>
|
||||
<p>设备型号。</p>
|
||||
<p>设备型号.</p>
|
||||
<h2>device.product<span><a class="mark" href="#device_device_product" id="device_device_product">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The name of the overall product.</p>
|
||||
<p>整个产品的名称。</p>
|
||||
<p>整个产品的名称.</p>
|
||||
<h2>device.bootloader<span><a class="mark" href="#device_device_bootloader" id="device_device_bootloader">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The system bootloader version number.</p>
|
||||
<p>设备Bootloader的版本。</p>
|
||||
<p>设备Bootloader的版本.</p>
|
||||
<h2>device.hardware<span><a class="mark" href="#device_device_hardware" id="device_device_hardware">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The name of the hardware (from the kernel command line or /proc).</p>
|
||||
<p>设备的硬件名称(来自内核命令行或者/proc)。</p>
|
||||
<p>设备的硬件名称(来自内核命令行或者/proc).</p>
|
||||
<h2>device.fingerprint<span><a class="mark" href="#device_device_fingerprint" id="device_device_fingerprint">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>A string that uniquely identifies this build. Do not attempt to parse this value.</p>
|
||||
<p>构建(build)的唯一标识码。</p>
|
||||
</div><p>A string that uniquely identifies this build. Do not attempt to parse this value.</p>
|
||||
<p>构建(build)的唯一标识码.</p>
|
||||
<h2>device.serial<span><a class="mark" href="#device_device_serial" id="device_device_serial">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>A hardware serial number, if available. Alphanumeric only, case-insensitive.</p>
|
||||
<p>硬件序列号。</p>
|
||||
<p>硬件序列号.</p>
|
||||
<h2>device.sdkInt<span><a class="mark" href="#device_device_sdkint" id="device_device_sdkint">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
|
||||
</ul>
|
||||
</div><p>The user-visible SDK version of the framework; its possible values are defined in Build.VERSION_CODES.</p>
|
||||
<p>安卓系统API版本。例如安卓4.4的sdkInt为19。</p>
|
||||
<p>安卓系统API版本. 例如安卓4.4的sdkInt为19.</p>
|
||||
<h2>device.incremental<span><a class="mark" href="#device_device_incremental" id="device_device_incremental">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The internal value used by the underlying source control to represent this build. E.g., a perforce changelist number or a git hash.</p>
|
||||
<h2>device.release<span><a class="mark" href="#device_device_release" id="device_device_release">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The user-visible version string. E.g., "1.0" or "3.4b5".</p>
|
||||
<p>Android系统版本号。例如"5.0", "7.1.1"。</p>
|
||||
<p>Android系统版本号. 例如"5.0", "7.1.1".</p>
|
||||
<h2>device.baseOS<span><a class="mark" href="#device_device_baseos" id="device_device_baseos">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The base OS build the product is based on.</p>
|
||||
<h2>device.securityPatch<span><a class="mark" href="#device_device_securitypatch" id="device_device_securitypatch">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The user-visible security patch level.</p>
|
||||
<p>安全补丁程序级别。</p>
|
||||
<p>安全补丁程序级别.</p>
|
||||
<h2>device.codename<span><a class="mark" href="#device_device_codename" id="device_device_codename">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>The current development codename, or the string "REL" if this is a release build.</p>
|
||||
<p>开发代号,例如发行版是"REL"。</p>
|
||||
<p>开发代号, 例如发行版是"REL".</p>
|
||||
<h2>device.getIMEI()<span><a class="mark" href="#device_device_getimei" id="device_device_getimei">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回设备的IMEI.</p>
|
||||
<h2>device.getAndroidId()<span><a class="mark" href="#device_device_getandroidid" id="device_device_getandroidid">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回设备的Android ID。</p>
|
||||
<p>Android ID为一个用16进制字符串表示的64位整数,在设备第一次使用时随机生成,之后不会更改,除非恢复出厂设置。</p>
|
||||
</div><p>返回设备的Android ID.</p>
|
||||
<p>Android ID为一个用16进制字符串表示的64位整数, 在设备第一次使用时随机生成, 之后不会更改, 除非恢复出厂设置.</p>
|
||||
<h2>device.getMacAddress()<span><a class="mark" href="#device_device_getmacaddress" id="device_device_getmacaddress">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type"><string></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">string</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回设备的Mac地址。该函数需要在有WLAN连接的情况下才能获取,否则会返回null。</p>
|
||||
<p><strong>可能的后续修改</strong>:未来可能增加有root权限的情况下通过root权限获取,从而在没有WLAN连接的情况下也能返回正确的Mac地址,因此请勿使用此函数判断WLAN连接。</p>
|
||||
</div><p>返回设备的Mac地址. 该函数需要在有WLAN连接的情况下才能获取, 否则会返回null.</p>
|
||||
<p><strong>可能的后续修改</strong>:未来可能增加有root权限的情况下通过root权限获取, 从而在没有WLAN连接的情况下也能返回正确的Mac地址, 因此请勿使用此函数判断WLAN连接.</p>
|
||||
<h2>device.getBrightness()<span><a class="mark" href="#device_device_getbrightness" id="device_device_getbrightness">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回当前的(手动)亮度。范围为0~255。</p>
|
||||
</div><p>返回当前的(手动)亮度. 范围为0~255.</p>
|
||||
<h2>device.getBrightnessMode()<span><a class="mark" href="#device_device_getbrightnessmode" id="device_device_getbrightnessmode">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回当前亮度模式,0为手动亮度,1为自动亮度。</p>
|
||||
</div><p>返回当前亮度模式, 0为手动亮度, 1为自动亮度.</p>
|
||||
<h2>device.setBrightness(b)<span><a class="mark" href="#device_device_setbrightness_b" id="device_device_setbrightness_b">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>b</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 亮度,范围0~255</li>
|
||||
<li><code>b</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 亮度, 范围0~255</li>
|
||||
</ul>
|
||||
</div><p>设置当前手动亮度。如果当前是自动亮度模式,该函数不会影响屏幕的亮度。</p>
|
||||
<p>此函数需要"修改系统设置"的权限。如果没有该权限,会抛出SecurityException并跳转到权限设置界面。</p>
|
||||
</div><p>设置当前手动亮度. 如果当前是自动亮度模式, 该函数不会影响屏幕的亮度.</p>
|
||||
<p>此函数需要"修改系统设置"的权限. 如果没有该权限, 会抛出SecurityException并跳转到权限设置界面.</p>
|
||||
<h2>device.setBrightnessMode(mode)<span><a class="mark" href="#device_device_setbrightnessmode_mode" id="device_device_setbrightnessmode_mode">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>mode</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 亮度模式,0为手动亮度,1为自动亮度</li>
|
||||
<li><code>mode</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 亮度模式, 0为手动亮度, 1为自动亮度</li>
|
||||
</ul>
|
||||
</div><p>设置当前亮度模式。</p>
|
||||
<p>此函数需要"修改系统设置"的权限。如果没有该权限,会抛出SecurityException并跳转到权限设置界面。</p>
|
||||
</div><p>设置当前亮度模式.</p>
|
||||
<p>此函数需要"修改系统设置"的权限. 如果没有该权限, 会抛出SecurityException并跳转到权限设置界面.</p>
|
||||
<h2>device.getMusicVolume()<span><a class="mark" href="#device_device_getmusicvolume" id="device_device_getmusicvolume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 整数值</li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 整数值</li>
|
||||
</ul>
|
||||
</div><p>返回当前媒体音量。</p>
|
||||
</div><p>返回当前媒体音量.</p>
|
||||
<h2>device.getNotificationVolume()<span><a class="mark" href="#device_device_getnotificationvolume" id="device_device_getnotificationvolume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 整数值</li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 整数值</li>
|
||||
</ul>
|
||||
</div><p>返回当前通知音量。</p>
|
||||
</div><p>返回当前通知音量.</p>
|
||||
<h2>device.getAlarmVolume()<span><a class="mark" href="#device_device_getalarmvolume" id="device_device_getalarmvolume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 整数值</li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 整数值</li>
|
||||
</ul>
|
||||
</div><p>返回当前闹钟音量。</p>
|
||||
</div><p>返回当前闹钟音量.</p>
|
||||
<h2>device.getMusicMaxVolume()<span><a class="mark" href="#device_device_getmusicmaxvolume" id="device_device_getmusicmaxvolume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 整数值</li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 整数值</li>
|
||||
</ul>
|
||||
</div><p>返回媒体音量的最大值。</p>
|
||||
</div><p>返回媒体音量的最大值.</p>
|
||||
<h2>device.getNotificationMaxVolume()<span><a class="mark" href="#device_device_getnotificationmaxvolume" id="device_device_getnotificationmaxvolume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 整数值</li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 整数值</li>
|
||||
</ul>
|
||||
</div><p>返回通知音量的最大值。</p>
|
||||
</div><p>返回通知音量的最大值.</p>
|
||||
<h2>device.getAlarmMaxVolume()<span><a class="mark" href="#device_device_getalarmmaxvolume" id="device_device_getalarmmaxvolume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 整数值</li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 整数值</li>
|
||||
</ul>
|
||||
</div><p>返回闹钟音量的最大值。</p>
|
||||
</div><p>返回闹钟音量的最大值.</p>
|
||||
<h2>device.setMusicVolume(volume)<span><a class="mark" href="#device_device_setmusicvolume_volume" id="device_device_setmusicvolume_volume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>volume</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 音量</li>
|
||||
<li><code>volume</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 音量</li>
|
||||
</ul>
|
||||
</div><p>设置当前媒体音量。</p>
|
||||
<p>此函数需要"修改系统设置"的权限。如果没有该权限,会抛出SecurityException并跳转到权限设置界面。</p>
|
||||
</div><p>设置当前媒体音量.</p>
|
||||
<p>此函数需要"修改系统设置"的权限. 如果没有该权限, 会抛出SecurityException并跳转到权限设置界面.</p>
|
||||
<h2>device.setNotificationVolume(volume)<span><a class="mark" href="#device_device_setnotificationvolume_volume" id="device_device_setnotificationvolume_volume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>volume</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 音量</li>
|
||||
<li><code>volume</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 音量</li>
|
||||
</ul>
|
||||
</div><p>设置当前通知音量。</p>
|
||||
<p>此函数需要"修改系统设置"的权限。如果没有该权限,会抛出SecurityException并跳转到权限设置界面。</p>
|
||||
</div><p>设置当前通知音量.</p>
|
||||
<p>此函数需要"修改系统设置"的权限. 如果没有该权限, 会抛出SecurityException并跳转到权限设置界面.</p>
|
||||
<h2>device.setAlarmVolume(volume)<span><a class="mark" href="#device_device_setalarmvolume_volume" id="device_device_setalarmvolume_volume">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>volume</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 音量</li>
|
||||
<li><code>volume</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 音量</li>
|
||||
</ul>
|
||||
</div><p>设置当前闹钟音量。</p>
|
||||
<p>此函数需要"修改系统设置"的权限。如果没有该权限,会抛出SecurityException并跳转到权限设置界面。</p>
|
||||
</div><p>设置当前闹钟音量.</p>
|
||||
<p>此函数需要"修改系统设置"的权限. 如果没有该权限, 会抛出SecurityException并跳转到权限设置界面.</p>
|
||||
<h2>device.getBattery()<span><a class="mark" href="#device_device_getbattery" id="device_device_getbattery">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 0.0~100.0的浮点数</li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 0.0~100.0的浮点数</li>
|
||||
</ul>
|
||||
</div><p>返回当前电量百分比。</p>
|
||||
</div><p>返回当前电量百分比.</p>
|
||||
<h2>device.isCharging()<span><a class="mark" href="#device_device_ischarging" id="device_device_ischarging">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type"><boolean></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">boolean</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回设备是否正在充电。</p>
|
||||
</div><p>返回设备是否正在充电.</p>
|
||||
<h2>device.getTotalMem()<span><a class="mark" href="#device_device_gettotalmem" id="device_device_gettotalmem">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回设备内存总量,单位字节(B)。1MB = 1024 * 1024B。</p>
|
||||
</div><p>返回设备内存总量, 单位字节(B). 1MB = 1024 * 1024B.</p>
|
||||
<h2>device.getAvailMem()<span><a class="mark" href="#device_device_getavailmem" id="device_device_getavailmem">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a></li>
|
||||
<li>{ <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回设备当前可用的内存,单位字节(B)。</p>
|
||||
</div><p>返回设备当前可用的内存, 单位字节(B).</p>
|
||||
<h2>device.isScreenOn()<span><a class="mark" href="#device_device_isscreenon" id="device_device_isscreenon">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li>返回 <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type"><boolean></a></li>
|
||||
<li>返回 { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">boolean</a> }</li>
|
||||
</ul>
|
||||
</div><p>返回设备屏幕是否是亮着的。如果屏幕亮着,返回<code>true</code>; 否则返回<code>false</code>。</p>
|
||||
<p>需要注意的是,类似于vivo xplay系列的息屏时钟不属于"屏幕亮着"的情况,虽然屏幕确实亮着但只能显示时钟而且不可交互,此时<code>isScreenOn()</code>也会返回<code>false</code>。</p>
|
||||
</div><p>返回设备屏幕是否是亮着的. 如果屏幕亮着, 返回<code>true</code>; 否则返回<code>false</code>.</p>
|
||||
<p>需要注意的是, 类似于vivo xplay系列的息屏时钟不属于"屏幕亮着"的情况, 虽然屏幕确实亮着但只能显示时钟而且不可交互, 此时<code>isScreenOn()</code>也会返回<code>false</code>.</p>
|
||||
<h2>device.wakeUp()<span><a class="mark" href="#device_device_wakeup" id="device_device_wakeup">#</a></span></h2>
|
||||
<p>唤醒设备。包括唤醒设备CPU、屏幕等。可以用来点亮屏幕。</p>
|
||||
<p>唤醒设备. 包括唤醒设备CPU、屏幕等. 可以用来点亮屏幕.</p>
|
||||
<h2>device.wakeUpIfNeeded()<span><a class="mark" href="#device_device_wakeupifneeded" id="device_device_wakeupifneeded">#</a></span></h2>
|
||||
<p>如果屏幕没有点亮,则唤醒设备。</p>
|
||||
<p>如果屏幕没有点亮, 则唤醒设备.</p>
|
||||
<h2>device.keepScreenOn([timeout])<span><a class="mark" href="#device_device_keepscreenon_timeout" id="device_device_keepscreenon_timeout">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>timeout</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 屏幕保持常亮的时间, 单位毫秒。如果不加此参数,则一直保持屏幕常亮。</li>
|
||||
<li><code>timeout</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 屏幕保持常亮的时间, 单位毫秒. 如果不加此参数, 则一直保持屏幕常亮.</li>
|
||||
</ul>
|
||||
</div><p>保持屏幕常亮。</p>
|
||||
<p>此函数无法阻止用户使用锁屏键等正常关闭屏幕,只能使得设备在无人操作的情况下保持屏幕常亮;同时,如果此函数调用时屏幕没有点亮,则会唤醒屏幕。</p>
|
||||
<p>在某些设备上,如果不加参数timeout,只能在Auto.js的界面保持屏幕常亮,在其他界面会自动失效,这是因为设备的省电策略造成的。因此,建议使用比较长的时长来代替"一直保持屏幕常亮"的功能,例如<code>device.keepScreenOn(3600 * 1000)</code>。</p>
|
||||
<p>可以使用<code>device.cancelKeepingAwake()</code>来取消屏幕常亮。</p>
|
||||
</div><p>保持屏幕常亮.</p>
|
||||
<p>此函数无法阻止用户使用锁屏键等正常关闭屏幕, 只能使得设备在无人操作的情况下保持屏幕常亮;同时, 如果此函数调用时屏幕没有点亮, 则会唤醒屏幕.</p>
|
||||
<p>在某些设备上, 如果不加参数timeout, 只能在Auto.js的界面保持屏幕常亮, 在其他界面会自动失效, 这是因为设备的省电策略造成的. 因此, 建议使用比较长的时长来代替"一直保持屏幕常亮"的功能, 例如<code>device.keepScreenOn(3600 * 1000)</code>.</p>
|
||||
<p>可以使用<code>device.cancelKeepingAwake()</code>来取消屏幕常亮.</p>
|
||||
<pre><code>//一直保持屏幕常亮
|
||||
device.keepScreenOn()
|
||||
</code></pre><h2>device.keepScreenDim([timeout])<span><a class="mark" href="#device_device_keepscreendim_timeout" id="device_device_keepscreendim_timeout">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>timeout</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 屏幕保持常亮的时间, 单位毫秒。如果不加此参数,则一直保持屏幕常亮。</li>
|
||||
<li><code>timeout</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 屏幕保持常亮的时间, 单位毫秒. 如果不加此参数, 则一直保持屏幕常亮.</li>
|
||||
</ul>
|
||||
</div><p>保持屏幕常亮,但允许屏幕变暗来节省电量。此函数可以用于定时脚本唤醒屏幕操作,不需要用户观看屏幕,可以让屏幕变暗来节省电量。</p>
|
||||
<p>此函数无法阻止用户使用锁屏键等正常关闭屏幕,只能使得设备在无人操作的情况下保持屏幕常亮;同时,如果此函数调用时屏幕没有点亮,则会唤醒屏幕。</p>
|
||||
<p>可以使用<code>device.cancelKeepingAwake()</code>来取消屏幕常亮。</p>
|
||||
</div><p>保持屏幕常亮, 但允许屏幕变暗来节省电量. 此函数可以用于定时脚本唤醒屏幕操作, 不需要用户观看屏幕, 可以让屏幕变暗来节省电量.</p>
|
||||
<p>此函数无法阻止用户使用锁屏键等正常关闭屏幕, 只能使得设备在无人操作的情况下保持屏幕常亮;同时, 如果此函数调用时屏幕没有点亮, 则会唤醒屏幕.</p>
|
||||
<p>可以使用<code>device.cancelKeepingAwake()</code>来取消屏幕常亮.</p>
|
||||
<h2>device.cancelKeepingAwake()<span><a class="mark" href="#device_device_cancelkeepingawake" id="device_device_cancelkeepingawake">#</a></span></h2>
|
||||
<p>取消设备保持唤醒状态。用于取消<code>device.keepScreenOn()</code>, <code>device.keepScreenDim()</code>等函数设置的屏幕常亮。</p>
|
||||
<p>取消设备保持唤醒状态. 用于取消<code>device.keepScreenOn()</code>, <code>device.keepScreenDim()</code>等函数设置的屏幕常亮.</p>
|
||||
<h2>device.vibrate(millis)<span><a class="mark" href="#device_device_vibrate_millis" id="device_device_vibrate_millis">#</a></span></h2>
|
||||
<div class="signature"><ul>
|
||||
<li><code>millis</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type"><number></a> 震动时间,单位毫秒</li>
|
||||
<li><code>millis</code> { <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">number</a> } 震动时间, 单位毫秒</li>
|
||||
</ul>
|
||||
</div><p>使设备震动一段时间。</p>
|
||||
</div><p>使设备震动一段时间.</p>
|
||||
<pre><code>//震动两秒
|
||||
device.vibrate(2000);
|
||||
</code></pre><h2>device.cancelVibration()<span><a class="mark" href="#device_device_cancelvibration" id="device_device_cancelvibration">#</a></span></h2>
|
||||
<p>如果设备处于震动状态,则取消震动。</p>
|
||||
<p>如果设备处于震动状态, 则取消震动.</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/sh_main.js"></script>
|
||||
<script src="assets/sh_javascript.min.js"></script>
|
||||
<script>highlight(undefined, undefined, 'pre');</script>
|
||||
<!-- __TRACKING__ -->
|
||||
</div>
|
||||
<script src="assets/sh_javascript.js"></script>
|
||||
<script src="assets/sh_java.js"></script>
|
||||
<script src="assets/sh_main.js"></script>
|
||||
<script>
|
||||
highlight(void 0, void 0, 'pre');
|
||||
highlight(void 0, void 0, 'tt');
|
||||
</script>
|
||||
<!-- __TRACKING__ -->
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user