How to query to "content://sms/conversations"?

Put your problem here if it does not fit any of the other categories.

How to query to "content://sms/conversations"?

Postby chousein » Mon Mar 22, 2010 11:19 pm

Hi,

I'm trying to query the sms conversations list. I execute the following line of code:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Cursor cur = this.getContentResolver().query(Uri.parse("content://sms/conversations"), null, null, null, null);
  3.  
  4.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


I also set the following permission in the manifest file:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <uses-permission android:name="android.permission.READ_SMS" />
  3.  
  4.  
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


However, apparently this permission does not allow to query the list of sms conversations. Does anybody know which permission to set to make this query?

Thank you in advance,

-Ali
User avatar
chousein
Developer
Developer
 
Posts: 32
Joined: Wed Feb 24, 2010 10:09 pm

Top

Re: How to query to "content://sms/conversations"?

Postby chousein » Wed Mar 24, 2010 12:11 am

Apparently it's not possible to execute the query:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Cursor cur = this.getContentResolver().query(Uri.parse("content://sms/conversations"), null, null, null, null);
  3.  
  4.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


I tried all sms related permissions, but always got an exception.

However, it's possible to execute the following instead:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Cursor cur = this.getContentResolver().query(Uri.parse("content://sms"), null, null, null, null);
  3.  
  4.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


This returns all sms messages (incoming, outgoing...) and the messages are returned sorted by date. You need to set only the READ_SMS permission in the manifest file. This query serves my purpose and I strongly believe it would serve any purpose which requires access to the list of conversations.

I googled around a bit to understand what "content://sms/conversations" is used for. Apparently people have used it for deleting a conversation and loading a conversation. I'm not aware of any other usage of it.

-Ali
User avatar
chousein
Developer
Developer
 
Posts: 32
Joined: Wed Feb 24, 2010 10:09 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 10 guests