EddyVerbruggen / Insomnia-PhoneGap-Plugin

:sleepy: Prevent the screen of the mobile device from falling asleep
264 stars 106 forks source link

How to auto keepAwake on launch of the app #25

Closed mirzabros closed 8 years ago

mirzabros commented 8 years ago

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

purplecabbage commented 8 years ago
document.addEventListener("deviceready",function() {
    window.plugins.insomnia.keepAwake();
});
Sharaal commented 8 years ago

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.

EddyVerbruggen commented 8 years ago

@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" />

Sharaal commented 8 years ago

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.

EddyVerbruggen commented 8 years ago

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