EddyVerbruggen / Insomnia-PhoneGap-Plugin

:sleepy: Prevent the screen of the mobile device from falling asleep

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to auto keepAwake on launch of the app

mirzabros opened this issue · comments

Hi there.

I have a switch ON OFF to keep screen awake. This is working file but I want to enable keepAwake from the time it starts the app.

Please help me out with this.

I am happy to pay for time.

Thanks

document.addEventListener("deviceready",function() {
    window.plugins.insomnia.keepAwake();
});

Hi,
I try the same: enable keepAwake on the app start.
Can you pls have a quick look into it if its a problem on my side or the plugin:

The app build can be found here: https://build.phonegap.com/apps/1944299/share

I tested it with the Samsung Galaxy A3 (2016) with Android 5.1.1.

@dragonprojects you're not including a reference to cordova.js in index.html. And you may want to consider using the plugin from npm instead of the old one on pgb: <plugin name="cordova-plugin-insomnia" source="npm" />

Thx, will try it.

little bit off topic: you know a good way to add the script tags into the index.html for some build specific javascripts (cordova.js and in my case the scorecard-phonegap.js) during the phonegap build?
So the normal webpage doesn't need to link them.

Google my friend, Google.
And if that fails: StackOverflow.