예제 #1
0
        public static IEnumerable <Thread> GetSentMMS(Context context)
        {
            var cursor = context.ContentResolver.Query(Android.Provider.Telephony.Sms.Sent.ContentUri,
                                                       new string[] { "address", "date", "body", "_id", "thread_id", "read" }, //columns
                                                       "thread_id",                                                            //GROUP BY
                                                       null,
                                                       null /*"DATE DESC"*/);

            var output = ConversationHelper.GetFullConvoListFromCursor(context, cursor);

            var grouped = from s in output
                          group s by s.ThreadId into m
                          select new { ThreadId = m.Key, MaxDate = m.Max(s => s.DateAsLong) };

            output = from o in output
                     join g in grouped on o.ThreadId equals g.ThreadId
                     where o.DateAsLong == g.MaxDate
                     select o;

            return(output);
        }