Auto.js学习笔记3—设备

本文档详细介绍了Auto.js的device模块,提供设备的相关信息,如屏幕分辨率、内存、电量,以及设备操作,包括调整亮度、音量、唤醒屏幕等功能。部分操作需要"修改系统设置"的权限。
摘要由CSDN通过智能技术生成

Device

        device模块提供了与设备有关的信息与操作,例如获取设备宽高,内存使用率,IMEI,调整设备亮度、音量等

        此模块的部分函数,例如调整音量,需要"修改系统设置"的权限,如果没有该权限,会抛出SecurityException并跳转到权限设置界面

目录

Device

device.width

device.height

device.buildId

device.broad

device.brand

device.device

device.model

device.product

device.bootloader

device.hardware

device.fingerprint

device.serial

device.sdkInt

device.incremental

device.release

device.baseOS

device.securityPatch

device.codename

device.getIMEI()

device.getAndroidId()

device.getMacAddress()

device.getBrightness()

device.getBrightnessMode()

device.setBrightness(b)

device.setBrightnessMode(mode)

device.getMusicVolume()

device.getNotificationVolume()

device.getAlarmVolume()

device.getMusicMaxVolume()

device.getNotificationMaxVolume()

device.getAlarmMaxVolume()

device.setMusicVolume(volume)

device.setNotificationVolume(volume)

device.setAlarmVolume(volume)

device.getBattery()

device.isCharging()

device.getTotalMem()

device.getAvailMem()

device.isScreenOn()

device.wakeUp()

device.wakeUpIfNeeded()

device.keepScreenOn([timeout])

device.keepScreenDim([timeout])

device.cancelKeepingAwake()

device.vibrate(ms)

device.cancelVibration()


device.width

  • {number}

设备屏幕分辨率宽度,例如1080

device.height

  • {number}

设备屏幕分辨率高度,例如1920

device.buildId

  • {string}

Either a change list number, or a label like "M4-rc20".

修订版本号,或者诸如"M4-rc20"的标识

device.broad

  • {string}

The name of the underlying board, like "goldfish".

设备的主板(?)型号

device.brand

  • {string}

The consumer-visible brand with which the product/hardware will be associated, if any.

与产品或硬件相关的厂商品牌,如"Xiaomi", "Huawei"等

device.device

  • {string}

The name of the industrial design.

设备在工业设计中的名称

device.model

  • {string}

The end-user-visible name for the end product.

设备型号

device.product

  • {string}

The name of the overall product.

整个产品的名称

device.bootloader

  • {string}

The system bootloader version number.

设备Bootloader的版本

device.hardware

  • {string}

The name of the hardware (from the kernel command line or /proc).

设备的硬件名称(来自内核命令行或者/proc)

device.fingerprint

  • {string}

A string that uniquely identifies this build. Do not attempt to parse this value.

构建(build)的唯一标识码

device.serial

  • {string}

A hardware serial number, if available. Alphanumeric only, case-insensitive.

硬件序列号

device.sdkInt

  • {number}

The user-visible SDK version of the framework; its possible values are defined in Build.VERSION_CODES.

安卓系统API版本,例如安卓4.4的sdkInt为19

device.incremental

  • {string}

The internal value used by the

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小馒头爱学Java

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值