由网友(自如你)分享简介:我试图发送使用的Android手机差距Sendsms插件的消息。但是,当我调用函数,我得到这个错误:I'm trying to send a message using The "Sendsms"plugin for phone gap on Android. But when I call the funct...
我试图发送使用的Android手机差距Sendsms插件的消息。但是,当我调用函数,我得到这个错误:
I'm trying to send a message using The "Sendsms"plugin for phone gap on Android. But when I call the function, I get this error:
Uncaught TypeError: Cannot call method 'send' of undefined at file
这是JS code我使用的是:
This is the JS code I'm using :
function onDeviceReady () {
$('#send').bind('click', function () {
alert('Phone: ' + $('#friendName').val() + ' Message: ' + $('#MessageContent').val());
window.plugins.sms.send($('#friendName').val(),
$('#MessageContent').val(),
function () {
alert('Message sent successfully');
},
function (e) {
alert('Message Failed:' + e);
}
);
});
}
document.addEventListener("deviceready", onDeviceReady, false);
我从Java code 这里&安培;添加权限:
<uses-permission android:name="android.permission.SEND_SMS"/>
和添加插件Plugins.xml。
And added the plugin to Plugins.xml.
你知道出了什么问题?
Do you know what's the problem ?
推荐答案
根据您所使用的是什么版本的PhoneGap,你可能只需要进入smsplugin.js,并用科尔多瓦替换的PhoneGap的实例。
Depending on what version of PhoneGap you are using you may just have to go into the smsplugin.js and replace the instances of "PhoneGap" with "cordova".
相关推荐
最新文章