现在的位置: 首页 > 综合 > 正文

发送短信

2013年03月20日 ⁄ 综合 ⁄ 共 402字 ⁄ 字号 评论关闭
public class SmsSender {
	public static final void sendSMS(Context c, PendingIntent intent, String content, String phoneNum) {
		if (null == c || null == content || null == phoneNum) {
			return;
		}
		
		SmsManager sms = SmsManager.getDefault();
		if (content.length() > 70) {
			List<String> msgs = sms.divideMessage(content);
			for (String msg : msgs) {
				sms.sendTextMessage(phoneNum, null, msg, intent, null);
			}
		} else {
			sms.sendTextMessage(phoneNum, null, content, intent, null);
		}
	}
}

抱歉!评论已关闭.