Plugin Insomnia not working

Hi,
I’m using the Insomnia plugin to prevent the screen of the mobile device from falling asleep.
Running it in debug mode"ionic cordova run android" I can see the log

'@ allowSleepAgain --> success'

but the mobile phone (Xiomi Redmi 4) after some minutes falls asleep as if the plugin didn’t exist.
This is how I’m using the plugin:

    // Enabling the stand-by of the mobile phone
    if (this.platform.is('cordova')) {
      this.insomnia.keepAwake()
        .then(
          (res) => {
            console.log(`'@ allowSleepAgain --> success'`);
          },
          (err) => {
            console.log('@ allowSleepAgain --> ERROR');
          }
        );
    }

Which could be the problem according to you?

`Ionic:
   Ionic CLI                     : 5.0.0 
   Ionic Framework               : @ionic/angular 4.3.0
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.2.4
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.4.1
Cordova:
   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 10 other plugins)
Utility:
   cordova-res : not installed
   native-run  : 0.2.2
System:
   Android SDK Tools : 26.1.1 (C:\Users\claudio\AppData\Local\Android\sdk\)
   NodeJS            : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10`

Thank you very much

cld

Is anyone using this plugin with success ?

I’m currently trying to use this plugin for my project, I’m running on Ionic 3 but the plugin doesn’t seem to work :frowning: I dunno why

@ioclaudio @technobabble
deploy this inside ngOnInit()

this.insomnia.keepAwake()
    .then(()=>
    {
      console.log("the app will stay awake")
    });

to disable this
deploy this in ngOnDestroy

this.insomnia.allowSleepAgain().then(()=>{
    console.log("the app will again sleep")
  })