Get message status for delivery report from pdu
This commit is contained in:
parent
5e5fd482cf
commit
d32829784a
@ -5,6 +5,7 @@ import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.telephony.SmsMessage;
|
||||
|
||||
public class MessageReceiver extends BroadcastReceiver{
|
||||
public static final String MESSAGE_RECEIVED = "com.hectorone.multismssender.SMS_RECEIVED";
|
||||
@ -20,9 +21,17 @@ public class MessageReceiver extends BroadcastReceiver{
|
||||
|
||||
Uri entryURI = intent.getData();
|
||||
if (entryURI != null){
|
||||
ContentValues values = new ContentValues(1);
|
||||
values.put(DeliveryDbAdapter.KEY_DELIVERY_ENTRY_DELIVERED, 1);
|
||||
context.getContentResolver().update(entryURI, values, null, null);
|
||||
byte[] pdu = intent.getByteArrayExtra("pdu");
|
||||
//createFromPdu (byte[] pdu) will be deprecated.
|
||||
//Use following instead
|
||||
//String format = intent.getStringExtra("format");
|
||||
//SmsMessage message = SmsMessage.createFromPdu(pdu, format);
|
||||
SmsMessage message = SmsMessage.createFromPdu(pdu);
|
||||
if(message.getStatus()== 0) {
|
||||
ContentValues values = new ContentValues(1);
|
||||
values.put(DeliveryDbAdapter.KEY_DELIVERY_ENTRY_DELIVERED, 1);
|
||||
context.getContentResolver().update(entryURI, values, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user