Android Sending Group SMS

harispp

New Member
Hi....

I need to crete an application like group messaging. For that I am using SmsManager class.

MY code look like

B4X:
static List<String> phone_num = new ArrayList<String>();
static List<String> SMS = new ArrayList<String>();

   @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
            readExcelFile(this, "/sdcard/Excel.xls");
    View readExcelButton = findViewById(R.id.buttonSend);
            readExcelButton.setOnClickListener(this);

}


      public void onClick(View v) {
        switch (v.getId()) {
        case R.id.buttonSend:
          for(int i=0;i<phone_num.size();i++)
            {
               SmsManager smsManager = SmsManager.getDefault();
               smsManager.sendTextMessage(phone_num.get(i),SMS.get(i), null, null);        
                }

  Toast.makeText(getBaseContext(), "Sendingfinished",Toast.LENGTH_SHORT).show();  


                break;
       default: break;
        }
    }


My question is, is it a right method for sending group sms. Or should I create pendingIntent with broadcast receiver to monitor the sending process and wait inside the for loop until each message send finished to send next.

Thanks in advance....
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…