卡住了SMSComposer
插件。我已按照所有步骤将密钥添加到插件列表并下载文件。这是来自 github 的最新版本,它让我感到困惑。我更了解旧的。如何指定toRecipients
和body
?
function SMSComposer()
{
this.resultCallback = null;
}
SMSComposer.ComposeResultType =
{
Cancelled:0,
Sent:1,
Failed:2,
NotSent:3
}
SMSComposer.prototype.showSMSComposer = function(toRecipients, body)
{
var args = {};
if(toRecipients)
args.toRecipients = toRecipients;
if(body)
args.body = body;
Cordova.exec("SMSComposer.showSMSComposer",args);
}
SMSComposer.prototype.showSMSComposerWithCB = function(cbFunction,toRecipients,body)
{
this.resultCallback = cbFunction;
this.showSMSComposer.apply(this,[toRecipients,body]);
}
SMSComposer.prototype._didFinishWithResult = function(res)
{
this.resultCallback(res);
}
Cordova.addConstructor(function() {
if(!window.plugins) {
window.plugins = {};
}
window.plugins.smsComposer = new SMSComposer();
});
.
<body>
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div <center><button onclick="cordova.exec(null,null, 'SMSComposer','showSMSComposer',[args])">Compose SMS</button></center>
>
</div>
<script type="text/javascript" src="cordova-2.2.0.js"></script>
<script type="text/javascript" src="js/index.js"></script> <script type="text/javascript" charset="utf-8" src="SMSComposer.js"></script>
<script type="text/javascript">
app.initialize();
var args;
// cordova.exec(null,null, 'SMSComposer','showSMSComposer',[args]);
</script>
</body>
</html>
编辑:当我按下button
. 控制台中没有错误消息。