我已经使用 2.3.0 版本开发了 phonegap 应用程序。这个应用程序也有
许多手机插件,如下载器、pdfviewer、状态栏通知、视频。现在
我想在同一个应用程序中实现 sms 插件。我已经尝试过
使用此应用程序实现短信插件,但不起作用。我觉得这很令人困惑
使用多个版本的cordova。所以请清除我的问题,如何包括
并编写使用phonegap发送短信的发送短信代码以及如何包含短信
插件到我的应用程序中。非常清楚地与我分享答案。提前致谢

最佳答案

此短信插件适用于 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>

关于javascript - 如何使用phonegap 2.3.0在android中发送短信?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17609629/

10-12 03:12