如何让Android的循环发送每条短信的发送报告? [英] How to get Delivery Report of each SMS sent in loop android?

查看:271
本文介绍了如何让Android的循环发送每条短信的发送报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的短信应用。我需要在循环发送短信。注册广播接收器中发送和接收状态。但问题是,如何区分哪个Delievery通知是为我发短信哪。我使用SMSMANAGER类来发送短信。我的问题是类似的这里讨论:如何监控每一个短信发送状态?

I am working on SMS app. I need to send SMS in loop. Registered Broadcast Receiver for SENT and DELIVERED status. But problem is how to distinguish which Delievery notification is for which SMS that i sent. I am using SMSMANAGER class to send SMS. My problem is similar discussed here: How to monitor each of Sent SMS status?

推荐答案

要SMS可以使用意图额外的字段进行区分。

To distinguish between SMS you can use extra field of the intent.

像::

Intent sent = new Intent(SENT);
intent.putExtra("MessageNum", i);
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
    sent, 0);

Intent delivered = new Intent(DELIVERED);
intent.putExtra("MessageNum", i);
PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
    delivered, 0);

而在广播接收器接收这些意图,使用 intent.getIntExtra()来知道邮件数量。

这篇关于如何让Android的循环发送每条短信的发送报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆