jquery - cordova SMS plugin -- javascript error -


i using cordova 3.6.3.
using following sms plugin.

http://plugins.cordova.io/#/package/com.rjfun.cordova.sms https://github.com/floatinghotpot/cordova-plugin-sms/tree/master/docs

i have added plugin in following way :--
cordova plugin add com.rjfun.cordova.sms

my cordova app when loaded calls following function doc_onload().

<body onload="doc_onload()"> 

then register handler "deviceready". when device ready device ready function called.

now problem inside initapp() handler sms plugin check not display alert message. able alert --> "kk" .

but in following check if (! sms ) did not display message. neither if nor else got satisfied.

even alert("end"); not displayed inside initapp() event handler.

please suggest why failing ?

function initapp() {     alert("initapp");     // attach fastclick handler     fastclick.attach(document.body);      alert("kk");      if (! sms )     {         alert( 'sms plugin not ready' );         return;     }     else     {         alert( 'sms plugin ok ' );     }      alert("end");      //add sms arrive listner handler     document.addeventlistener("onsmsarrive", processsms(), false);   }  //function doc_onload(page_type) function doc_onload() {     // task     alert("doc_onload");      // add event handler deviceready function     document.addeventlistener("deviceready", initapp(), false);  } 

remove brackets 'initapp()' in

document.addeventlistener("deviceready", initapp, false);

edit ** above semantics

i think need change !sms

typeof sms === 'undefined' 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -