Skip to main content
Version: Next

Taro.getScreenBrightness(option)

Gets screen brightness.

Note

  • If the auto brightness adjustment feature is enabled in the Android system, the screen brightness will be automatically adjusted according to the light. And this API can only obtain the brightness value before the auto brightness adjustment, instead of the real-time brightness value.

Reference

Type

(option?: Option) => Promise<SuccessCallbackOption>

Parameters

Option

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SuccessCallbackOption

PropertyTypeDescription
valuenumberScreen brightness. Range: 0 (Darkest) to 1 (Brightest).

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getScreenBrightness✔️✔️