1

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

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);

I got the java code from here & added the permission:

    <uses-permission android:name="android.permission.SEND_SMS"/>

And added the plugin to Plugins.xml.

Do you know what's the problem ?

Sana Joseph
  • 1,948
  • 7
  • 37
  • 58

1 Answers1

1

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

Simon MacDonald
  • 23,253
  • 5
  • 58
  • 74