I find this function in web android developer offficial
public final Cursor query (Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder, CancellationSignal cancellationSignal)
Now, I want to get sms from content://sms/sent , with thread_id of sms I will get only sms newest.
I will explain by example:
id | thread_id | phone | body
10 47
9 46
8 47
7 45
6 47
5 43
4 45
3 42
2 41
1 47
For result I want to receive is:
id | thread_id | phone | body
10 47
9 46
7 45
5 43
3 42
2 41
How must I do with query above? Thanks.
You must use
GROUP BY thread_id
, see more details in my github repository SmsMessenger, you can get it by following query: