Android上的Cordova应用程序 - 屏幕可能无法入睡

时间:2016-03-02 14:59:23

标签: android cordova android-4.4-kitkat

我正在使用cordova构建Android应用程序。此应用程序应以全屏模式运行,屏幕可能永远不会关闭。我对设备进行了完全的根控制 - 所有这些都安装在Android 4.4上 - 安装了应用程序。

我已经设置了

Developer options -> Stay awake -> checked

并在

Display->Sleep

我设置了最高值,即30分钟。这些设备都连接到电源上。

我的 config.xml 如下所示:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.project.name" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Project </name>
    <description>
      Project
    </description>
    <author email="my@email.com">
      Test
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
      <allow-intent href="market:*" />
      <splash src="res/screen/android/test.png" />
      <preference name="Fullscreen" value="true" />
      <preference name="KeepRunning" value="true"/>
      <preference name="InAppBrowserStorageEnabled" value="true"/>
      <preference name="LoadingDialog" value="Application is loading"/>
      <preference name="ErrorUrl" value="error.html"/>
      <preference name="LogLevel" value="VERBOSE"/>
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>

</widget>

我的问题是,在我在显示选项中设置的时间后,屏幕会变暗(不完全关闭)。例如。屏幕保持亮30分钟,之后确实保持亮起,但背光非常暗。

我能做些什么,屏幕保持亮度?

1 个答案:

答案 0 :(得分:5)

我找到了一个插件,为我做了诀窍:

window.plugins.insomnia.keepAwake()

然后在Javascript中:

    Traceback (most recent call last):
  File "clustering.py", line 16, in <module>
    ds = df[np.where(labels==i)]
  File "/usr/lib/python2.7/dist-packages/pandas/core/frame.py", line 1678, in __getitem__
    return self._getitem_column(key)
  File "/usr/lib/python2.7/dist-packages/pandas/core/frame.py", line 1685, in _getitem_column
    return self._get_item_cache(key)
  File "/usr/lib/python2.7/dist-packages/pandas/core/generic.py", line 1050, in _get_item_cache
    res = cache.get(item)
TypeError: unhashable type: 'numpy.ndarray'

按预期工作,屏幕始终打开。