android alertdialog - phonegap build issue with simple navigator.notification.alert -


i'm using phonegap build compile android apk, when call simple

navigator.notification.alert(       'this message',     // mensaje (message)       alertdismissed,         // función 'callback' (alertcallback)       'game over',            // titulo (title)       'close'                // nombre del botón (buttonname)       ); 

it doesn't work here index.html code

<html>     <head>         <meta charset="utf-8" />         <meta name="format-detection" content="telephone=no" />         <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />         <link rel="stylesheet" type="text/css" href="css/index.css" />         <title>hello world</title>     </head>     <body>         <div class="app">             <h1>phonegap</h1>             <div id="deviceready" class="blink">                 <p class="event listening">connecting device</p>                 <p class="event received">device ready</p>             </div>         </div>         <script type="text/javascript" src="phonegap.js"></script>         <script type="text/javascript" src="js/index.js"></script>         <script type="text/javascript">             app.initialize();         </script>     </body> </html> 

and index.js

var app = {     // application constructor     initialize: function() {         this.bindevents();     },     // bind event listeners     //     // bind events required on startup. common events are:     // 'load', 'deviceready', 'offline', , 'online'.     bindevents: function() {         document.addeventlistener('deviceready', this.ondeviceready, false);     },     // deviceready event handler     //     // scope of 'this' event. in order call 'receivedevent'     // function, must explicity call 'app.receivedevent(...);'     ondeviceready: function() {         app.receivedevent('deviceready');     },     // update dom on received event     receivedevent: function(id) {         var parentelement = document.getelementbyid(id);         var listeningelement = parentelement.queryselector('.listening');     var receivedelement = parentelement.queryselector('.received');          listeningelement.setattribute('style', 'display:none;');         receivedelement.setattribute('style', 'display:block;');     app.showalert();         console.log('received event: ' + id);     },     alertdismissed: function()     {       console.log('called function');     },     showalert: function()     {       navigator.notification.alert(       'eres el ganador!',     // mensaje (message)       alertdismissed,         // función 'callback' (alertcallback)       'game over',            // titulo (title)       'cerrar'                // nombre del botón (buttonname)       );     }, }; 

the app starts , shows "device ready" alert doesn't appear

sorry english , me

try including script tags in <head> of index.html. have feeling deviceready not getting called because "ready" time tries load phonegap.js.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -