您的位置:首页 > 其它

利用smsmanager实现后台发送短信示例

2014-01-11 15:53 627 查看

复制代码 代码如下:
public void sendServiceSms(Context mContext,String content) {
try {
SmsManager manager = SmsManager.getDefault();
PendingIntent sentIntent = PendingIntent.getBroadcast(mContext, 0,
new Intent(SMS_SENT_TEST_ACTION), 0);
manager.sendTextMessage("13912345670", null, content, sentIntent, null);
} catch (Exception e) {
e.printStackTrace();
}
}

参数说明
sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent):
destinationAddress:接收方的手机号码
scAddress:发送方的手机号码
text:信息内容
sentIntent:发送是否成功的回执,
DeliveryIntent:接收是否成功的回执。

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息