I'm trying to implement insomnia plugin to keep my app awake


#1

And i’m not having success :frowning: , i installed it automatically

Running

cordova plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git

then

cordova prepare

,

In my app.js i put these lines of code:

if (window.cordova && window.cordova.plugins && window.cordova.plugins.insomnia){

                             alert("yes.");
                             } else {
                             alert("insomnia plugin missing");
                             }

and i get:

“insomnia plugin missing” message

I posted here because i wanted to receive some guidance (i feel like i lose my north and don’t know what to do in order to get that plugin working). Please i need some help.

Thanks for reading,


#2

window.plugins.insomnia not window.cordova.plugins.insomnia


#3

Thank you! it worked, oh god i’m such a rookie in this.

Again , Thanks for answering. Guess that this topic can be closed.