我正在创建一个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
发布评论