gpt4 book ai didi

meteor - 如何让手机屏幕一直亮着

转载 作者:行者123 更新时间:2023-12-04 18:05:29 29 4
gpt4 key购买 nike

我正在开发一个运行时间很长的 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 https://github.com/apache/cordova-plugin-file#c452f1a67f41cb1165c92555f0e721fbb07329cc). 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

关于meteor - 如何让手机屏幕一直亮着,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29489661/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com