# uni.getScreenBrightness(options)

获取屏幕亮度。

# getScreenBrightness 兼容性

Web 微信小程序 Android iOS HarmonyOS HarmonyOS(Vapor)
x 4.41 5.08 5.08 4.81 5.0

# 参数

名称 类型 必填 默认值 兼容性 描述
options GetScreenBrightnessOptions -
名称 类型 必备 默认值 兼容性 描述
success (result: GetScreenBrightnessSuccess) => void -
成功返回的回调函数
fail (result: UniError) => void -
失败的回调函数
complete (result: string) => void -
结束的回调函数(调用成功、失败都会执行)

# GetScreenBrightnessSuccess 的属性值

名称 类型 必备 默认值 兼容性 描述
value number -
屏幕亮度值,范围 0~1,0 最暗,1 最亮。

# 的属性值

合法值 兼容性 描述
interface
-
interface
-

# 参见

# uni.setScreenBrightness(options)

设置屏幕亮度。

# setScreenBrightness 兼容性

Web 微信小程序 Android iOS HarmonyOS HarmonyOS(Vapor)
x 4.41 5.08 5.08 4.81 5.0

# 参数

名称 类型 必填 默认值 兼容性 描述
options SetScreenBrightnessOptions -
名称 类型 必备 默认值 兼容性 描述
value number -
屏幕亮度值,范围 0~1,0 最暗,1 最亮
success (result: SetScreenBrightnessSuccess) => void -
接口调用成功的回调函数
fail (result: UniError) => void -
接口调用失败的回调函数
complete (result: string) => void -
接口调用结束的回调函数(调用成功、失败都会执行)

# 的属性值

合法值 兼容性 描述
interface
-
interface
-

# 参见

# uni.setKeepScreenOn(options)

设置是否保持常亮状态。仅在当前应用生效,离开应用后设置失效。

# setKeepScreenOn 兼容性

Web 微信小程序 Android iOS HarmonyOS HarmonyOS(Vapor)
5.08 4.41 5.08 5.08 4.81 5.0

# 参数

名称 类型 必填 默认值 兼容性 描述
options SetKeepScreenOnOptions -
-
名称 类型 必备 默认值 兼容性 描述
keepScreenOn boolean -
是否保持屏幕常亮
success (result: SetKeepScreenOnSuccess) => void -
接口调用成功的回调函数
fail (result: UniError) => void -
接口调用失败的回调函数
complete (result: string) => void -
接口调用结束的回调函数(调用成功、失败都会执行)

# SetKeepScreenOnSuccess 的属性值

名称 类型 必备 默认值 兼容性 描述
errMsg string -
调用结果

# 的属性值

合法值 兼容性 描述
interface
-
-
interface
-

# 参见

# 通用类型

# GeneralCallbackResult

名称 类型 必备 默认值 兼容性 描述
errMsg string -
错误信息