Search code examples
cordovaphonegap-pluginscordova-plugins

Implementing SMSplugin getting error: Uncaught ReferenceError: sms is not defined


I am using this SMS Plugins for my android application but I when I am running the app in AVD LogCat is giving me this error in green and blue color : Uncaught ReferenceError: sms is not defined . and it is not executing the success or error function.

Please help me to solve this.

Thanks in advance.

submitSMSClick = function() {
        alert("click");
        var name = document.getElementById("nameSMS").value;
        var number = "09475641021";
        var message = name + ": " + $("#messageSMS").val();
        var intent = "INTENT";
        //leave empty for sending sms using default intent
        var success = function() {
            alert('Message sent successfully');
        };
        var error = function(e) {
            alert('Message Failed:' + e);
        };
        sms.send(number, message, intent, success, error);
};

Solution

  • All one need to do is to include the sms.js file present inside www/plugins/org.apache.cordova.plugin.sms/ with his main html file.