If I have a list of numbers how can I send an sms message to them using Android SDK.
Thanks.
If I have a list of numbers how can I send an sms message to them using Android SDK.
Thanks.
A single message can be sent using SmsManager. Also you can find an example here.
Though I think the only way to send SMS to multiple recipients is to loop thru the list and send messages one-by-one.
on Click Button Write the following code;
sendButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
String dest = destiny.getText().toString();
if(dest.indexOf(",")>0)
{
for(int i=0;i<dest.length();i++)
{
multiContact = dest.split(",");
}
}
String sms = message.getText().toString();
if(PhoneNumberUtils.isWellFormedSmsAddress(dest))
{
for(String contact:multiContact)
{
smsManager.sendTextMessage(contact, null, sms, null, null);
Toast.makeText(SampleSms.this, "SMS messgae Sent to"+contact, Toast.LENGTH_LONG).show();
}
}
else
{
Toast.makeText(SampleSms.this, "SMS messgae Sent failed", Toast.LENGTH_LONG).show();
}
}
});