cordova-plugin-backlight

Cordova Screen Backlight Plugin

Usage no npm install needed!

<script type="module">
  import cordovaPluginBacklight from 'https://cdn.skypack.dev/cordova-plugin-backlight';
</script>

README

Cordova Backlight Release

This 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.

Setup

Add the plugin using cordova cli:

cordova plugin add cordova-plugin-backlight

Javascript Interface

// 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);
});