Brightness

Improve this doc

$ ionic plugin add cordova-plugin-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';


let brightnessValue: number = 0.8;
Brightness.setBrightness(brightnessValue);

Static 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