uni.getScreenBrightness(options)
获取屏幕亮度。
getScreenBrightness 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
| x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | GetScreenBrightnessOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | x | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | success | (result: GetScreenBrightnessSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 成功返回的回调函数 | | fail | (result: UniError) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 失败的回调函数 | | complete | (result: string) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 结束的回调函数(调用成功、失败都会执行) |
|
GetScreenBrightnessSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| value | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 屏幕亮度值,范围 0~1,0 最暗,1 最亮。 |
的属性值
| 合法值 | 兼容性 | 描述 |
| interface | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | x | - | - | - | - |
| - |
| interface | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | x | - | - | - | - |
| - |
参见
uni.setScreenBrightness(options)
设置屏幕亮度。
setScreenBrightness 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
| x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | SetScreenBrightnessOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | x | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | value | number | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 屏幕亮度值,范围 0~1,0 最暗,1 最亮 | | success | (result: SetScreenBrightnessSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 接口调用成功的回调函数 | | fail | (result: UniError) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 接口调用失败的回调函数 | | complete | (result: string) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | x | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
的属性值
| 合法值 | 兼容性 | 描述 |
| interface | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | x | - | - | - | - |
| - |
| interface | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | x | - | - | - | - |
| - |
参见
uni.setKeepScreenOn(options)
设置是否保持常亮状态。仅在当前应用生效,离开应用后设置失效。
setKeepScreenOn 兼容性
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
| 5.08 | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
参数
| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |
| options | SetKeepScreenOnOptions | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| |
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 | | keepScreenOn | boolean | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | 5.08 | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 是否保持屏幕常亮 | | success | (result: SetKeepScreenOnSuccess) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | 5.08 | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 接口调用成功的回调函数 | | fail | (result: UniError) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | 5.08 | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 接口调用失败的回调函数 | | complete | (result: string) => void | 否 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | 5.08 | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 接口调用结束的回调函数(调用成功、失败都会执行) |
|
SetKeepScreenOnSuccess 的属性值
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
|
HarmonyOS(Vapor)
| | 5.08 | 4.41 | 5.08 | 5.08 | 4.81 | 5.0 |
| 调用结果 |
的属性值
| 合法值 | 兼容性 | 描述 |
| interface | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | - | - | - | - |
| - |
| interface | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | x | - | - | - | - |
| - |
参见
通用类型
GeneralCallbackResult
| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |
| errMsg | string | 是 | - | |
Web
|
微信小程序
|
Android
|
iOS
|
HarmonyOS
| | - | 4.41 | - | - | - |
| 错误信息 |