Insomnia

Contents

Prevent the screen of the mobile device from falling asleep.

Installation

ionic cordova plugin add cordova-plugin-insomnianpm install @ionic-native/insomnia
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEYnpm install @ionic-enterprise/insomnia

Supported Platforms

  • Android
  • Browser
  • Firefox OS
  • iOS
  • Windows
  • Windows Phone 8

Usage

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

constructor(private insomnia: Insomnia) { }

...

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

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