Sendsms插件无法在Phonegap上运行
我正在尝试使用“Sendsms”插件发送消息,用于Android上的手机差距。 但是当我调用该函数时,我收到此错误:
Uncaught TypeError: Cannot call method 'send' of undefined at file
这是我正在使用的JS代码:
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代码并添加了权限:
并将插件添加到Plugins.xml。
你知道这是什么问题吗?
根据您使用的PhoneGap版本,您可能只需要进入smsplugin.js并将“PhoneGap”的实例替换为“cordova”。