Question

I am trying to capture mms events in android- I have a ContentResolver which I am setting as follows:

final String[] projection = new String[] { "retr_st", "date", "_id", "ct_t" };
Uri uri = Uri.parse("content://mms-sms/conversations");

Cursor cursor = contentResolver.query(uri, projection, null, null,"_id DESC");

When the cursor is set, it with the error: FATAL EXCEPTION java.lang.NullPointerException.

This odd thing is that this works on my older versions of android, but not on the galaxy s3. SMS also seems to work fine. Any ideas? Thanks in advance!

FATAL EXCEPTION: main
java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1431)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
at android.content.ContentResolver.query(ContentResolver.java:372)
at android.content.ContentResolver.query(ContentResolver.java:315)
at com.onguardian.mobile.DataCollector.getMMS(DataCollector.java:116)
at com.onguardian.mobile.SentinelService.grabMMS(SentinelService.java:709)
at com.onguardian.mobile.SentinelService.access$3(SentinelService.java:700)
at com.onguardian.mobile.SentinelService$5.run(SentinelService.java:144)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4950)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)
Was it helpful?

Solution

Try the simplfied URI as it may be looking for a database field that's not there on the Galaxy S3.

Do as follows:

Uri uri = Uri.parse("content://mms-sms/conversations?simple=true");

and if that also does not work, try to set the projection as a "*", so the phone will basically query all fields available.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top