Brightness

Improve this doc

$ ionic plugin add cordova-plugin-brightness
$ npm install --save @ionic-native/brightness

Repo: https://github.com/mgcrea/cordova-plugin-brightness

The Brightness plugin let you control the display brightness of your device.

Requires Cordova plugin: cordova-plugin-brightness. For more info, please see the Brightness plugin docs.

Supported platforms

Usage

import { Brightness } from '@ionic-native/brightness';

constructor(private brightness: Brightness) { }

...

let brightnessValue: number = 0.8;
this.brightness.setBrightness(brightnessValue);

Instance Members

setBrightness(Floating)

Sets the brightness of the display.

Param Type Details
Floating value

number between 0 and 1 in which case 1 means 100% brightness and 0 means 0% brightness.

Returns: Promise<any> Returns a Promise that resolves if setting brightness was successful.

getBrightness()

Reads the current brightness of the device display.

Returns: Promise<any> Returns a Promise that resolves with the brightness value of the device display (floating number between 0 and 1).

setKeepScreenOn()

Keeps the screen on. Prevents the device from setting the screen to sleep.

API

Native

General