How to Know which Sms is sent/delivered from Android BroadcastReceiver?

一曲冷凌霜 提交于 2019-12-04 15:42:19

Finally I got the answer by added intent extras to pending intent with sms create datetime, then update sms status based on datetime that sent by extras data, here is the snippet :

Intent sentIntent = new Intent(Cons.SMS_SENT);
sentIntent.putExtra("createdTime", createdTime);

Intent deliveryIntent = new Intent(Cons.SMS_SENT);
deliveryIntent.putExtra("createdTime", createdTime);

then I can identify which sms is sent/delivery by created time

 public void onReceive(Context context, Intent intent) {
        String smsDateTimeAsID = intent.getStringExtra("createdTime");
 }

Cons.SMS_SENT and Cons.SMS_DELIVERED Values

    String SENT = "SMS_SENT";
    String DELIVERED = "SMS_DELIVERED";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!