代码
private void sendMessage(String contact, String message) {
SmsManager smsManager = SmsManager.getDefault();
PendingIntent sentIntent = PendingIntent.getBroadcast(this, 0, new Intent(), 0);
if (message.length() > 70) {
List<String> msgs = smsManager.divideMessage(message);
for (String msg : msgs) {
smsManager.sendTextMessage(contact, null, msg, sentIntent, null);
}
} else {
smsManager.sendTextMessage(contact, null, message, sentIntent, null);
}
Toast.makeText(this, "短信发送完成", Toast.LENGTH_LONG).show();
}