Search code examples
androidsmsbroadcastreceivertelephony

How to check for delivery report when using "*0#" method?


Before I explain further, I would like to say this is for an Xposed module, but I don't believe the information I need relies on any Xposed knowledge.

I'm writing a method just know which (thanks to Xposed) runs just before onReceive method is called of a class SMSReceiver extends BroadcastReceiver. For those not familiar with Xposed, this just allows me to place a method before onReceive any time it is called, allowing me to check arguments sent to it, change arguments, among other things.

But this is just for background, my real need is to figure out how to check if a message received is a delivery report.

My network (giffgaff) allows delivery reports by prepending *0# to messages, which when received on the other phones, replies automatically with a delivery report. So for example, this would occur.

Sender sends: *0#Test

Receiver sees: Test

Sender sees: Message [number here] to [number here] delivered at [time] on [date] Text: 'Test'

I've tried using getResultCode() to check if the received text is a delivery report but this does not seem to work. Any suggestions?


Solution

  • From what I can tell from available information on GiffGaff, your delivery report comes through as a regular SMS message, in which case there's nothing to distinguish it from any other message, apart from the content. I doubt the originating address would even be of any help, as it would most likely be a service center number, not the destination address.

    So, about the only way to figure that out would be to parse the message and see if it fits the template you've shown, and if the destination numbers agree.