Sendsms插件不工作的PhoneGap [英] Sendsms plugin not working on Phonegap

查看:136
本文介绍了Sendsms插件不工作的PhoneGap的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发送使用的Andr​​oid手机差距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 <一个href=\"https://github.com/phonegap/phonegap-plugins/blob/master/Android/SMSPlugin/src/net/practicaldeveloper/phonegap/plugins/SmsPlugin.java\"相对=nofollow>这里&安培;添加权限:

    <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".

这篇关于Sendsms插件不工作的PhoneGap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆