Saturday, November 3, 2012

[android-developers] Sending group SMS android

Hi....

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

MY code look like


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....


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment