唤醒程序插件的PhoneGap构建代码没有'不起作用

PhoneGap Build Code of wakeuptimer plugin doesn't work

本文关键字:不起作用 代码 插件 程序 PhoneGap 构建 唤醒      更新时间:2024-03-11

嗨,我正在处理使用插件唤醒定时器的项目,问题是我从SuccessCallback(这是唤醒的第一个参数)"唤醒未处理类型"我使用github的插件https://github.com/wnyc/cordova-plugin-wakeuptimer我的index.html我必须在哪里修改JS才能使其工作?

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <!--<meta name="viewport" ... /> -->
        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
        <script type="text/javascript" charset="utf-8">
            function init() {
                document.addEventListener("deviceready", onDeviceReady, false);
            }
            function onDeviceReady() {
                myDevice = document.getElementById('deviceProperties');

                myDevice.innerHTML = window.wakeuptimer.wakeup(function(result) {
                    if (result.type==='wakeup') {
                        alert('wakeup alarm detected--' + result.extra);
                    } else if(result.type==='set'){
                        alert('wakeup alarm set--' + result);
                    } else {
                        alert('wakeup unhandled type (' + result.type + ')');
                    }
                }, function() {
                    alert('Error!');
                }, {alarms : [{type : 'onetime',
                    time : { hour : 15, minute : 00 },
                    extra : { message : 'json containing app-specific information to be posted when alarm triggers' }, 
                    message : 'Alarm has expired!'}]
                    }
);
        }



        </script>
    </head>
    <body>
        <h1>Dane z alarmu</h1>
        <button type="button" id="deviceProperties" onclick="init()">Ustaw alarm</button>
    </body>
</html>

版本要求

此插件适用于Cordova 3.5.0+。

我使用PGB的版本1,所以这句话是一个答案