android 群发短信

public void sendSms(){

     String mobile = getPhoneNums();

if (TextUtils.isEmpty(mobile)) {

Toaster.showShort(ClientsAttentionedActivity.this, "请添加感兴趣客户");

return;

}

 

Intent intent = new Intent();

Uri smsUri = Uri.parse("smsto:" + mobile);

intent.setAction("android.intent.action.SENDTO");

         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

         intent.putExtra("cmp", "com.android.mms/.ui.ComposeMessageActivity");

         intent.setData(smsUri);

startActivity(intent);

}

private String getPhoneNums() {

if (mItems == null || mItems.size() == 0) {

return null;

}

 

StringBuffer sb = new StringBuffer();

for (Client client : mItems) {

sb.append(client.getPhone()).append(";");

}

 

if (sb.length() > 0) {

sb.deleteCharAt(sb.length() - 1);

}

 

return sb.toString();

}

//短信联系人号码必须使用 " ; "分隔开来。

你可能感兴趣的:(android)