How can Telephony.Sms.Conversations be used to retrieve convo information to String?
I tried:
ContentResolver cr = context.getContentResolver();
Cursor convo = cr.query(Telephony.Sms.Conversations.CONTENT_URI,
new String[] { Telephony.Sms.Conversations.ADDRESS,
Telephony.Sms.Conversations.PERSON },
null,
null,
Telephony.Sms.Conversations.DEFAULT_SORT_ORDER);
How ever I get error invalid column address. when I remove address I get invalid column person. What column's does this class provide? (I couldn't find anything on the API reference page or any examples online. btw I already have a working code to retrieve inbox and outbox but I would like to get conversations too (I mean title and num of msges), without matching inbox and outbox results)
You can only get "msg_count" and "snippet" values from Telephony.Sms.Conversations, and you can get the "address" value from Telephony.TextBasedSmsColumns.
private static final String[] SMS_CONVERSATIONS_PROJECTION = new String[]{"msg_count", "snippet"};
Cursor cursor = cr.query(Telephony.Sms.Conversations.CONTENT_URI,
SMS_CONVERSATIONS_PROJECTION, null, null,Telephony.Sms.Conversations.DEFAULT_SORT_ORDER);
while(cursor.moveToNext()) {
int msg_count = cursor.getInt(cursor.getColumnIndex("msg_count"));
String snippet = cursor.getString(cursor.getColumnIndex("snippet"));
}
cursor.close;
It's inconvenient for us without "address", "date" and so on.
Telephony.Sms.Conversation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With