Cordova Screen Backlight Plugin
npm install cordova-plugin-backlightThis plugin provides interface to turn on or off the backlight of the screen on your device. This is not like brightness, as this will completely turn off the backlight, showing nothing but a black screen.
Note: this plugin only works for Android for now, help wanted for iOs implementation.
Add the plugin using cordova cli:
``bash`
cordova plugin add cordova-plugin-backlight
`javascript
// turn on backlight
window.cordova.plugins.Backlight.on(function onSuccess() {
// backlight is on
}, function onError(error) {
console.error(error);
});
// turn off backlight
window.cordova.plugins.Backlight.off(function onSuccess() {
// backlight is off
}, function onError(error) {
console.error(error);
});
``