0

If I have a list of numbers how can I send an sms message to them using Android SDK.

Thanks.

Roman Prykhodchenko
  • 12,655
  • 8
  • 29
  • 33

2 Answers2

0

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.

Community
  • 1
  • 1
Asahi
  • 13,378
  • 12
  • 67
  • 87
0

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();
            }
        }
    });
Balban
  • 718
  • 3
  • 9
  • 24