Android Receive SMS Intent: Get Message Id or Thread Id

3.9k views Asked by At

I have register a Broadcast listener to receive the android.provider.Telephony.SMS_DELIVER Intent action.

I seem to be able to get the body, and sender phone number of this new message.

However I am not able to get the Message Id or Thread Id of this new message. The only way I have found is to search the message and conversation tables for matching content. But this seems a little messy and I feel like there should be a neater way.

Side note:
Is there some SMS documentation that I have missed? Because a lot of the SMS api seems very undocumented.

1

There are 1 answers

6
David Wasser On BEST ANSWER

There are no message IDs or thread IDs in SMS. Each SMS is a data packet that is completely independent of all other SMS. In Android, there is a standard SMS application that stores SMS in a database and "threads" conversations using some criteria which is not contained within the SMS message itself. However, third parties can also build SMS applications that manage the messages in a completely different way. This is very much dependent on the concept and implementation of the specific application that is managing the SMS. This is also why there isn't much documentation about the SMS system. The API that is available in Android is very low-level and very basic. Other applications build on top of this.