Menu

Why does the SDK return a NullPointerException when I access the SMS/MMS content URI?

The standard Android content URI used to access the SMS and MMS is not supported on Samsung devices and leads to NullPointerException. The URI works fine on other Android devices.

Uri uri = Uri.parse("content://mms-sms/conversations/"); Cursor query = null; query = this.context.getContentResolver().query(uri, null, null, null, null);

To access SMS or MMS on Samsung devices, use either of the below content URIs.

Note that these Samsung-specific content URIs are not part of the Android SDK and so should not be accessed by android applications on non-Samsung devices. For more information, see http://developer.samsung.com/android/technical-docs/Common-Issues-in-Android.

  1. content://mms-sms/conversations/?simple=true
    The column projections are:
    • _id
    • date
    • message_count
    • recipient_ids
    • snippet
    • snippet_cs
    • read
    • type
    • error
    • has_attachment
    • unread_count
    • alert_expired
    • reply_all
    • group_snippet
    • message_type
    • display_recipient_ids
    • translate_mode
    • secret_mode
  2. content://sms/inbox/
    The column projections are:
    • _id
    • thread_id
    • address
    • person
    • date
    • date_sent
    • protocol
    • read
    • status
    • type
    • reply_path_present
    • subject
    • body
    • service_center
    • locked
    • error_code
    • seen
    • deletable
    • sim_slot
    • sim_imsi
    • hidden
    • group_id
    • group_type
    • delivery_date
    • app_id
    • msg_id
    • callback_number
    • reserved
    • pri
    • teleservice_id
    • link_url
    • svc_cmd
    • svc_cmd_content
    • roam_pending
Share it: