I'm working on a Meteor Application which runs for long times and I'm looking for a way to keep the screen on when there's no user activity (while the app is running of course).
Thanks
Choose System, then Power & sleep from the right navigation menu. If you're using a laptop, click the drop-down menu under On battery power, turn off after under Screen and select Never. Additionally, select Never under When plugged in, turned off after. Also, do the same for the Sleep section under Power and sleep.
First, swipe down once from the top of the screen and tap the gear icon. Next, go to the “Advanced Features” section in the Settings. Now, select the “Motions and Gestures” option. Lastly, toggle the switch on for “Keep Screen On While Viewing.”
If I read the documentation correctly, and I may not, because I've never used this before, then you can add the insomnia plugin to your cordova/phonegap build like this:
$ meteor add cordova:nl.x-services.plugins.insomnia@https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin/tarball/47ba15a4ad791eb4d5a0643cdb7ef69f73109e15
And then use:
window.plugins.insomnia.keepAwake()
and
window.plugins.insomnia.allowSleepAgain()
Update for Meteor 1.2:
Install plugins from a Git URL: Meteor no longer supports installing Cordova plugins from tarball URLs, but does support Git URLs with a SHA reference (like https://github.com/apache/cordova-plugin-file#c452f1a67f41cb1165c92555f0e721fbb07329cc). Existing GitHub tarball URLs are converted automatically.
This means that you now need to use:
$ meteor add cordova:nl.x-services.plugins.insomnia@https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin#47ba15a4ad791eb4d5a0643cdb7ef69f73109e15
Update 2
As user3819370 points out, the plugin is now in the registry being used by meteor, so you can simply install it like this:
meteor add cordova:[email protected]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With