In cordova as has been sad in github.com/cordova-sms/cordova-sms-plugin/issues/8 we can use multiple numbers but i have this error,
sendSms2: function (id) {
try {
var number = "'"+window.localStorage.getItem("NUMBERS") + "'";
var message = window.localStorage.getItem("TEXT");
alert(number + " : " + message);
console.log("number=" + number + ", message= " + message);
//CONFIGURATION
var options = {
replaceLineBreaks: false, // true to replace \n by a new line, false by default
android: {
intent: ''
}
};
var success = function () {
alert('Message sent successfully for:' + id);
};
var error = function (e) {
alert('Message Failed:' + e);
};
sms.send('9133333333,9122222222', message, options, success, error);
} catch (e) {
alert(e);
}
},
but i get "Message Failed:error" in alert,
It works for one, but not for more,
This is not possible,
use for loop
sendSms2: function (id) {
try {
var busyFlag = 0;
if (!busyFlag) {
var number = '9133333333,9122222222';
var numbers = number.split(",");
var message = 'test';
alert(number + " : " + message);
//CONFIGURATION
var options = {
replaceLineBreaks: false, // true to replace \n by a new line, false by default
android: {
intent: '' // send SMS without open any other app
}
};
var success = function () {
alert('Message sent successfully for:' + id);
};
var error = function (e) {
alert('Message Failed:' + e);
};
for (var i = 0; i < numbers.length; i++) {
busyFlag = 1;
sms.send(numbers[i], message, options, success, error);
}
busyFlag = 0;
}
} catch (e) {
alert(e);
}
}