Flutter教程

Insomnia

Contents

Prevent the screen of the mobile device from falling asleep.

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

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic 睡眠 Insomnia插件的安装(Installation)

ionic cordova plugin add cordova-plugin-insomnia npm 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=YOURPRODUCTKEY npm install @ionic-enterprise/insomnia

Ionic 睡眠 Insomnia插件支持的平台(Supported Platforms)

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

Ionic 睡眠 Insomnia插件的用法(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')
  );