SmsManager manager=SmsManager.getDefault(); ArrayList<String> texts=manager.divideMessage(ctn);//存放多条短信 for(String msg:texts) { manager.sendTextMessage(number, null,texts,null,null) }
public void sendTextMessage (String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)ParametersdestinationAddress | 发送短信的地址(也就是号码) |
---|
scAddress | 短信服务中心,如果为null,就是用当前默认的短信服务中心 |
---|
text | 短信内容 |
---|
sentIntent | 如果不为null,当短信发送成功或者失败时,这个PendingIntent会被广播出去成功的结果代码是Activity.RESULT_OK,或者下面这些错误之一 :RESULT_ERROR_GENERIC_FAILURE
RESULT_ERROR_RADIO_OFF
RESULT_ERROR_NULL_PDU 对于 RESULT_ERROR_GENERIC_FAILURE, the这个sentIntent可能包括额外的"errorCode",包含一些具体有用的信息帮助检查 。基于SMS控制的全部程序检查 sentIntent. 如果 sentIntent 为空,the caller will be checked against all unknown applications, which cause smaller number of SMS to be sent in checking period. |
---|
deliveryIntent | 如果不为null,当这个短信发送到接收者那里,这个PendtingIntent会被广播,状态报告生成的pdu(指对等层次之间传递的数据单位)会拓展到数据("pdu") |
---|
Manifest: <users-permission android:name="android:permission.SEND_SMS"/>
|