当前位置 : 主页 > 手机开发 > cordova >

流星 – 如何保持手机屏幕

来源:互联网 收集:自由互联 发布时间:2021-06-10
我正在研究一个运行很长时间的Meteor应用程序,我正在寻找一种在没有用户活动时保持屏幕的方法(当然应用程序在运行时). 谢谢 如果我正确阅读了 documentation,而我可能没有,因为我以前从
我正在研究一个运行很长时间的Meteor应用程序,我正在寻找一种在没有用户活动时保持屏幕的方法(当然应用程序在运行时).

谢谢

如果我正确阅读了 documentation,而我可能没有,因为我以前从未使用过这个,那么你可以将 insomnia plugin添加到你的cordova / phonegap版本中,如下所示:

$meteor add cordova:nl.x-services.plugins.insomnia@https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin/tarball/47ba15a4ad791eb4d5a0643cdb7ef69f73109e15

然后使用:

window.plugins.insomnia.keepAwake()

window.plugins.insomnia.allowSleepAgain()

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
07003).
Existing GitHub tarball URLs are converted automatically.

这意味着您现在需要使用:

$meteor add cordova:nl.x-services.plugins.insomnia@https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin#47ba15a4ad791eb4d5a0643cdb7ef69f73109e15

更新2

正如user3819370指出的那样,该插件现在位于meteor使用的注册表中,因此您可以像这样安装它:

meteor add cordova:cordova-plugin-insomnia@4.0.1
网友评论