Like the Message app, the first Activity displays the lastest SMS grouped by person and the count number.
Example I had exchanged 50 texts with Chris, 60 with Aline, 40 with Ray ... The app displays something like this
Chris (50) Hey how are you lately ? Aline (60) Let's catch up Ray (40) Here is my number Ethan (1) I wrote a solution
I'm trying to do the same . I query all the SMS then I sort them. At least it's O(n) efficient .
Cursor cur = this.getContentResolver().query(Uri.parse("content://sms"), null, null, null, null);
int count = cur.getCount();
// iterate all the SMS
for (int i=1 ; i<=count ; i++){
// processing
....
cur.moveToNext();
}
Is there a way to query the latest messages (received or sent no draft type) grouped by person and get the number of SMS from a person ? I suppose there are multiple queries.
I think this will do what you want:
Cursor cur = this.getContentResolver().query(Uri.parse( "content://mms-sms/conversations?simple=true"), null, null, null, "normalized_date desc" );
The returned cursor will contain the latest message in every conversation and the amount of messages in each 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