views:

131

answers:

1

Hi,

I query "content//sms/" and don't know what some fields are. They are -

  1. Thread ID
  2. Protocol
  3. Status
  4. Reply_Path_Present
  5. Service_Center

I check them in LogCat. I find them like below

  • Thread ID : 1 to 6 etc..
  • Protocol : null / 0
  • Status : -1
  • Reply_Path_Present : null / 0
  • Service_Center : null

Please tell me what they are.

A: 

You can use Cursor.getColumnNames() to retrieve the column names of any content provider, e.g.

ContentResolver contentResolver = getContentResolver();
Cursor cursor = contentResolver.query(
    Uri.parse("content://sms/inbox"), null, null, null, null);

String[] columnNames = cursor.getColumnNames();

For content://sms/inbox this yields _id, thread_id, address, person, date, protocol, read, status, type, reply_path_present, subject, body, service_center, locked on my phone.

You can also have a look at the SmsProvider but it is not part of the public API.

Josef
Thanks a lot, Josef. sorry for my weakness in English. I mean as an example, what it means in value of status '-1'. Are there just 15 fields of content//sms? Does it depend on Android version? Where and how could I learn the open source code like ur shared link, SmsProvider? Actually, I've worked in Android for 2 months. So let me know more.
The SMS content provider itself is "not part of the public API". If it were, you would see classes for it in the `android.provider` package. See http://android-developers.blogspot.com/2010/05/be-careful-with-content-providers.html
CommonsWare
Thank you. let me know that the above 5 fields are used for what.