class SmsMessagingDemo extends Activity{
//短信内容
String content="xxxxxxxxxxx";
// 短信接收者
String recipient = "oooooo";
//获得默认的短信管理器
SmsManager sms = SmsManager.getDefault();
//拆分短信内容
List<String> messages = sms.divideMessage(contentTextEdit.getText().toString());
//发送所有内容
for (String message : messages) {
sms.sendTextMessage(recipient, null, message, PendingIntent.getBroadcast(
SmsMessagingDemo.this, 0, new Intent(ACTION_SMS_SENT), 0), null);
}
}
|
|