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);

扫描二维码关注公众号,回复: 571939 查看本文章

         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();

}

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

猜你喜欢

转载自892848153.iteye.com/blog/2076829