https://www.npmjs.com/package/cordova-sms-pluginandroid
https://github.com/cordova-sms/cordova-sms-plugingit
Using the Cordova CLI and NPM, run:github
cordova plugin add cordova-sms-plugin
It is also possible to install via repo url directly (unstable), run :npm
cordova plugin add https://github.com/cordova-sms/cordova-sms-plugin.git
HTMLapp
<input id="numberTxt" placeholder="Enter mobile number" value="" type="tel" /> <textarea id="messageTxt" placeholder="Enter message"></textarea> <input type="button" onclick="app.sendSms()" value="Send SMS" />
Javascripturl
var app = { sendSms: function() { var number = document.getElementById('numberTxt').value; var message = document.getElementById('messageTxt').value; alert(number); alert(message); //CONFIGURATION var options = { replaceLineBreaks: false, // true to replace \n by a new line, false by default android: { intent: 'INTENT' // send SMS with the native android SMS messaging //intent: '' // send SMS without open any other app } }; var success = function () { alert('Message sent successfully'); }; var error = function (e) { alert('Message Failed:' + e); }; sms.send(number, message, options, success, error); } };