Phonegap通知错误

时间:2013-08-20 10:36:43

标签: cordova phonegap-plugins

我是phonegap的新手,我正试图用这样的代码显示通知

<!DOCTYPE html>
<html>
    <head>
        <title>Notification Test</title>
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <script type="text/javascript" src="cordova.js" charset="utf-8"></script>
        <script type="text/javascript" charset="utf-8">
        // Wait for Cordova to load
        //
        function onLoad() {
            document.addEventListener("deviceready", onDeviceReady, false);
        }
        function onDeviceReady() {
            navigator.splashscreen.hide();
        }

        function showDisclaimer(){
                navigator.notification.confirm(
                    'Message',      // message
                    disclaimerDismiss,          // callback
                    'Disclaimer',               // title
                    'Si','No'                   // buttonNames
                );
            }
            function disclaimerDismiss(buttonIndex) {
                if(buttonIndex = 1){
                    navigator.app.exitApp();
                }
        }
        </script>
    </head>
    <body>
        <p><a href="#" onclick="showDisclaimer(); return false;">Show Disclaimer</a></p>
    </body>
</html>

当我尝试按下按钮时出现错误,我收到了错误

  

“无法调用未定义的方法确认”

但我没有错误

navigator.splashscreen.hide();

所以我认为问题是通知对象。我应该如何设置我的项目以使其有效?我目前安装在项目中的插件是

  

'org.apache.cordova.core.AudioHandler',   'org.apache.cordova.core.camera',   'org.apache.cordova.core.file',   “org.apache.cordova.core.file转移”   'org.apache.cordova.core.geolocation',   “org.apache.cordova.core.media捕获”   'org.apache.cordova.core.splashscreen'

那么,怎么了? 提前致谢

1 个答案:

答案 0 :(得分:2)

好的,我是个白痴,看着

http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

我发现我错过了通知和振动插件,现在一切正常;)

相关问题