I googled several times but couldn't find what I was looking for. Android assigns an id to each sms message. I wanted to know if this id is always unique? Can I rely on it to identify sms messages or should I assign my own?
Thanks :)
I googled several times but couldn't find what I was looking for. Android assigns an id to each sms message. I wanted to know if this id is always unique? Can I rely on it to identify sms messages or should I assign my own?
Thanks :)
Since it uses the SQLite, that is a relational database, it's impossible to have a duplicate identifier.
Check out the source code for
MmsSmsDatabaseHelper
and note the implementation of thecreateSmsTables
method:The
_id
that is assigned to each sms message is aPRIMARY KEY
so yes, it uniquely identifies each sms message.SMS_ID is always unique for every message.But There is also another column named Thread_ID which is common for every conversation, i.e. very conversation in android phone has given unique Thread_Id.But each message within that particular thread has a unique SMS_ID