Android Receive SMS Intent: Get Message Id or Thread Id

喜夏-厌秋 提交于 2019-12-06 01:57:21

问题


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 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.



来源:https://stackoverflow.com/questions/30778794/android-receive-sms-intent-get-message-id-or-thread-id

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