Skip to content Skip to sidebar Skip to footer

Trying To Read Sms/mms On Android And Geting Java.lang.nullpointerexception

I'm trying to read SMS/MMS on Android, and I have followed the answer, when writing the code and try to run it on an Android OS 6.0.1 on Samsung device I got the following exceptio

Solution 1:

This happens on many other Samsung devices: seems that on these devices, you can't query for content://mms-sms/conversations?simple=true without the ?simple=true suffix - and when you add this suffix, it affects the returned columns, and that's why the projection failed.

See here for more related info about this, though no one really knows why it behaves this way :(

There might be a workaround, using an undocumented URI of content://mms-sms/complete-conversations - as you can read here.


Solution 2:

I had the same problem with Samsung devices, so for just SMS conversations, I tried doing grouping by thread id on the SMS table here.

Unfortunately content://mms-sms/complete-conversations doesn't seem to aggregate on the thread id like content://mms-sms/conversations does, so you end up with multiple messages from the same thread.


Post a Comment for "Trying To Read Sms/mms On Android And Geting Java.lang.nullpointerexception"