Ionic Brightness


Ionic Brightness This plugin enables us to control the brightness of device. It is very easy to install and use this plugin. Here in this article we are going to cover this with simple example.


Ionic Brightness Native Example

You can manage the brightness of your device using this plugin. First let us see how to install it.

Installation

You can install the cordova plugin cordova-plugin-brightness simply as below-

Ionic Manage Brightness Native Plugin Example:

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

Supported Platforms

  • Android
  • iOS

Example

Ionic Native Brightness Example:

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

constructor(private brightness: Brightness) { }

...

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

Instance Members

  • setBrightness(Floating)– Set the device brightness(value 0-100)
  • getBrightness()– Get the device current brightness.
  • setKeepScreenOn()– Do’t let the screen sleep.

Advertisements

Add Comment

📖 Read More