【问题标题】:Broadcast Receiver for Sent SMS发送短信的广播接收器
【发布时间】:2013-05-14 23:50:59
【问题描述】:

android中是否有Broadcast Receiver来监听短信发送事件?

在我的应用程序中,我想计算每个预定义时间间隔发送的 SMS 数量。如果无法收听发送的短信,任何人都可以分享代码来计算短信和指定时间,例如过去 30 分钟。

【问题讨论】:

  • 为什么不每隔几分钟打开一次短信数据库,跟踪手机发送的短信数量。
  • 你能给我任何打开短信数据库的示例吗?

标签: android sms broadcastreceiver


【解决方案1】:

检查此链接....我认为它不是完整的解决方案,但您知道如何实施...

http://www.anddev.org/other-coding-problems-f5/sms-mms-contentobserver-and-service-t12938.html

您可以实现 content://sms/sent observer se.. 所以如果有任何更改,那么您可以获取事件,以便您可以计算或获取发送的 sms 或 mms 的操作.......

【讨论】:

    【解决方案2】:

    您可以使用 Google 的 SmsManager api 编辑自己的短信,并通过 PendingIntent 收到通知:

    SmsManager smsManager = SmsManager.getDefault();
    smsManager.sendTextMessage (String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)
    

    您可以通过参数收到交货通知:PendingIntent sentIntent

    但是 SmsManager 现在已被弃用:(

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-08
      • 1970-01-01
      • 2011-05-06
      • 1970-01-01
      • 2012-11-14
      • 1970-01-01
      相关资源
      最近更新 更多