Cordova Notification.alert在phonegap版本3.1.0中不起作用

Cordova Notification.alert在phonegap版本3.1.0中不起作用,cordova,phonegap-build,Cordova,Phonegap Build,我正在创建一个phonegap应用程序。我已使用notification.alert显示消息。在更新phonegap 3.1.0之前,notification.clert运行良好。正如我用PhoneGap2.9.0做的5个应用程序一样。在我使用过的每个应用程序中,都使用了来自的notification.alert 现在我已经在2014年1月28日构建了我的工作项目,它显示只有3个应用程序(Iphone、android和windows)可以使用phonegap完成。我正在为IOS和Android创

我正在创建一个phonegap应用程序。我已使用notification.alert显示消息。在更新phonegap 3.1.0之前,notification.clert运行良好。正如我用PhoneGap2.9.0做的5个应用程序一样。在我使用过的每个应用程序中,都使用了来自的notification.alert

现在我已经在2014年1月28日构建了我的工作项目,它显示只有3个应用程序(Iphone、android和windows)可以使用phonegap完成。我正在为IOS和Android创建。除了警觉外,一切正常。新的phonegap有什么问题吗?是否有新的方法或命令显示警报消息


请帮助我为什么它不起作用。如果你有其他想法,请帮助我

从3.0版开始,Phonegap/Cordova将设备级API作为插件实现,因此您必须将其包含在www文件夹中的config.xml中

<gap:plugin name="org.apache.cordova.dialogs" />
包括它之后,你可以像这样使用它

<!DOCTYPE html>
<html>
  <head>
    <title>Notification Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //
    function onDeviceReady() {
        // Empty
    }

    // alert dialog dismissed
        function alertDismissed() {
            // do something
        }

    // Show a custom alertDismissed
    //
    function showAlert() {
        navigator.notification.alert(
            'You are the winner!',  // message
            alertDismissed,         // callback
            'Game Over',            // title
            'Done'                  // buttonName
        );
    }

    </script>
  </head>
  <body>
    <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
  </body>
</html>

通知示例
//等待加载设备API库
//
文件。添加的监听器(“deviceready”,OnDeviceraddy,false);
//设备API可用
//
函数ondevicerady(){
//空的
}
//警报对话框已关闭
函数{
//做点什么
}
//显示自定义警报
//
函数showAlert(){
navigator.notification.alert(
“你是赢家!”,//留言
AlertDisabled,//回调
“游戏结束了”,//标题
'完成'//buttonName
);
}


你可以进一步研究。快乐编码

昨天,当我从2.9升级时,我偶然发现了一个类似的问题。很高兴我能帮忙:)
<!DOCTYPE html>
<html>
  <head>
    <title>Notification Example</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Wait for device API libraries to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // device APIs are available
    //
    function onDeviceReady() {
        // Empty
    }

    // alert dialog dismissed
        function alertDismissed() {
            // do something
        }

    // Show a custom alertDismissed
    //
    function showAlert() {
        navigator.notification.alert(
            'You are the winner!',  // message
            alertDismissed,         // callback
            'Game Over',            // title
            'Done'                  // buttonName
        );
    }

    </script>
  </head>
  <body>
    <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
  </body>
</html>