2013-07-12 62 views
3

我已經開發了phonegap應用程序使用2.3.0版本。這個應用程序也有 很多手機插件,如下載器,pdfviewer,statusbarnotification,video.Now 我想實現短信插件到同一個應用程序。 實施與此應用程序的短信插件,但不工作。我很困惑 與cordova的多個版本。所以請清除我的問題,如何包括 並編寫用於使用phonegap發送短信的發送短信代碼,以及如何將短信 插件包括到我的應用程序中。與我分享答案提前十分clearly.thanks如何在android中使用phonegap 2.3.0發送短信?

回答

2

這短信插件是PhoneGap的2.3.0

SendSmsCordovaPlugin

樣品:

<script type="text/javascript"> 
                    sendSmsDemo = function() { 
                        cordova.exec(function(winParam) { 
                                // Use the following line if json2 library is present. 
                                // Available from Douglas Crockford's github page here: 
                                // https://github.com/douglascrockford/JSON-js/blob/master/json2.js 
                                console.log(JSON.stringify(winParam)); 
                                alert(winParam.sms_send); 
                            } 
                            , function(error) { 
                                alert("An error has occurred"); 
                                console.log("An error has occurred"); 
                                // Please refer to previous comment about json2 library. 
                                console.log(JSON.stringify(error)); 
                            } 
                            , "SendSms" 
                             ,"SendSms" 
                             , ["TESTNUM", "This is random text."]); 
                    } 
                    </script> 
+0

請你給我任何示例代碼使用這個插件發送短信。 – cheliyan

+0

添加了示例,它位於資產/ www內 – jcesarmobile