Insomnia
Prevent the screen of the mobile device from falling asleep.
Repo: https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-insomnia $ npm install --save @ionic-native/insomnia@4
- Add this plugin to your app's module
Supported platforms
- Android
- Browser
- Firefox OS
- iOS
- Windows
- Windows Phone 8
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>