Insomnia

Improve this doc

$ ionic plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git
$ npm install --save @ionic-native/insomnia

Repo: https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin

Prevent the screen of the mobile device from falling asleep.

Supported platforms

Usage

import { Insomnia } from '@ionic-native/insomnia';

constructor(private insomnia: Insomnia) { }

...

this.insomnia.keepAwake()
  .then(
    () => console.log('success'),
    () => console.log('error')
  );

this.insomnia.allowSleepAgain()
  .then(
    () => console.log('success'),
    () => console.log('error')
  );

Instance Members

keepAwake()

Keeps awake the application

Returns: Promise<any>

allowSleepAgain()

Allows the application to sleep again

Returns: Promise<any>

API

Native

General