Starting from version 1078, the API prefix has been changed from hbs to qg. The original prefix hbs is still supported.
API | Description |
|---|---|
Obtains the screen brightness. | |
Sets whether to keep the screen steady on. | |
Sets the screen brightness. |
Parameter | Type | Mandatory | Description |
|---|---|---|---|
success | function | No | Callback function triggered upon a successful API call. For details, please refer to Parameters in the success callback function. |
fail | function | No | Callback function triggered upon a failed API call. |
complete | function | No | If a function is passed, it will be called regardless of whether the API call succeeds or fails. |
qg.getScreenBrightness({
success : function (res) {
console.log("getScreenBrightness success value = " + res.value);
},
fail:function(){
console.log("getScreenBrightness fail");
},
complete:function() {
console.log("getScreenBrightness complete");
}
}); Parameter | Type | Mandatory | Description |
|---|---|---|---|
keepScreenOn | boolean | Yes | Indicates whether to keep the screen steady on. |
success | function | No | Callback function triggered upon a successful API call. |
fail | function | No | Callback function triggered upon a failed API call. |
complete | function | No | If a function is passed, it will be called regardless of whether the API call succeeds or fails. |
qg.setKeepScreenOn({
keepScreenOn : true ,
success : function () {
console.log("setKeepScreenOn success" );
},
fail:function(){
console.log("setKeepScreenOn fail");
},
complete:function() {
console.log("setKeepScreenOn complete");
}
}); Parameter | Type | Mandatory | Description |
|---|---|---|---|
value | number | Yes | Screen brightness. The value ranges from 0 to 1, where 0 indicates the darkest and 1 indicates the brightest. |
success | function | No | Callback function triggered upon a successful API call. |
fail | function | No | Callback function triggered upon a failed API call. |
complete | function | No | If a function is passed, it will be called regardless of whether the API call succeeds or fails. |
qg.setScreenBrightness({
value: 0.5,
success: function () {
console.log("setScreenBrightness success");
},
fail: function () {
console.log("setScreenBrightness fail");
},
complete: function () {
console.log("setScreenBrightness complete");
}
});