Notification.alert不工作在phonegap build 3.1.0

编程入门 行业动态 更新时间:2024-10-14 00:29:28
本文介绍了Notification.alert不工作在phonegap build 3.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在创建一个phonegap应用程序。我使用notification.alert显示消息。在更新phonegap 3.1.0之前notification.clert工作正常。正如我已经做了约5个应用程序使用phonegap 2.9.0。在每个应用程式中,我使用了来自这的notification.alert

I am creating a phonegap application. I have used notification.alert to show messages. Before updation of phonegap 3.1.0 the notification.clert was working fine. As i have done about 5 app using phonegap 2.9.0. In every app i have used notification.alert from this

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

Now i have build my working project on 28th jan 2014, It is showing only 3 apps (Iphone, android and windows) can be done using phonegap. I am creating for IOS and Android. Everything is working fine except alert. Is there any problem in new phonegap? Is there any new method or command to show alert messages?

请帮助我为什么它不工作。如果你有任何其他想法,那么请帮助我。

Please help me why it is not working. If you have any other idea then please help me.

推荐答案

从3.0版本开始,Phonegap / Cordova实现设备级API作为插件,所以你必须包括在你的配置。在www文件夹中找到xml

As of version 3.0, Phonegap/Cordova implements device-level APIs as plugins so you have to include this in your config.xml found in the www folder

<gap:plugin name="org.apache.cordova.dialogs" />

或者从phonegap CLI手动添加:

or add it manually from the phonegap CLI like this:

$ cordova plugin add cordova-plugin-dialogs $ cordova plugin ls [ 'org.apache.cordova.dialogs' ] $ cordova plugin rm org.apache.cordova.dialogs

包括它之后,你可以使用这样

After you include it you can use like this

<!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>

您可以进一步研究此处。快乐编码!

You can research further here . Happy coding!

更多推荐

Notification.alert不工作在phonegap build 3.1.0

本文发布于:2023-11-27 19:54:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639385.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   alert   Notification   build   phonegap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!