0

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

Thanks.

Roman Prykhodchenko
  • 11,734
  • 7
  • 26
  • 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,128
  • 11
  • 67
  • 85
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
  • 748
  • 3
  • 9
  • 24