May 19, 2021 WeChat Mini Program Development Document
Base library 1.2.0 starts to support, and low versions need to be compatible
Set the screen brightness.
OBJECT parameter description:
Parameters | Type | Required | Description |
---|---|---|---|
value | Number | Is | Screen brightness values, ranging from 0 to 1,0 darkest and 1 brightest |
success | Function | Whether | The interface call was successful |
fail | Function | Whether | The interface calls the failed callback function |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Base library 1.2.0 starts to support, and low versions need to be compatible
Gets the screen brightness.
OBJECT parameter description:
Parameters | Type | Required | Description |
---|---|---|---|
success | Function | Whether | The interface call was successful |
fail | Function | Whether | The interface calls the failed callback function |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Success returns a description of the parameters:
Parameters | Type | Description |
---|---|---|
value | Number | Screen brightness values, ranging from 0 to 1,0 darkest and 1 brightest |
Base library 1.4.0 starts to support, and low versions need to be compatible
Set whether to keep it on. The settings are invalid only after the current program is in effect, after leaving the small program.
OBJECT parameter description:
The name of the argument | Type | Required | Description |
---|---|---|---|
keepScreenOn | Boolean | Is | Whether to keep the screen always on |
success | Function | Whether | The interface calls a successful callback function |
fail | Function | Whether | The interface calls the failed callback function |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
Success returns a description of the parameters:
The name of the argument | Type | Description |
---|---|---|
errMsg | String | The result of the call |
Example code:
// 保持屏幕常亮
wx.setKeepScreenOn({
keepScreenOn: true
})