user3092778
user3092778

Reputation: 109

Send multiple SMS text messages in Phonegap or Cordova

http://javatechig.com/phonegap/phonegap-sms-plugin-android

Please, this is very important, so important I will set a bounty to the person who answers this question the best.

Anyways, with the script in the URL in the provided, how would I set this so that you could send the same message to many text addresses, multiple text addresses but not in a group message header; in other words, send the same message separately to many different people.

Thanks so much :)

Note that I would be cool with having different input fields, which you could enter phone numbers in.

Upvotes: 2

Views: 2758

Answers (1)

Alon Gubkin
Alon Gubkin

Reputation: 57129

Markup:

<div>
    <input type="tel" id="phoneNumbers" />
    <input type="text" id="message" />
</div>

JS:

$(function () {
    var message = $('#message').val();
    $.each($('#phoneNumbers').val().split(/[ ,]+/)), function (phoneNumber) {
        SmsPlugin.prototype.send(phoneNumber, message, '');
    });
});

The phoneNumbers field supports separating phone numbers by commas, whitespace, and comma + whitespace. For example this should work:

111111111, 222222222,333333333 444444444, 55555555

Upvotes: 7

Related Questions