gpt4 book ai didi

android - MMS 和 SMS 之间的日期列长度不同

转载 作者:行者123 更新时间:2023-11-29 00:33:11 26 4
gpt4 key购买 nike

当查询 Android 的 MMS-SMS Content Provider 时,日期列对于 MMS 和 SMS 具有不同的纪元时间值。

ContentResolver contentResolver = getContentResolver();
final String[] projection = new String[] { "body", "person", "sub",
"subject", "retr_st", "type", "date" + " as " + "d", "ct_cls", "sub_cs",
"_id", "read", "ct_l", "st", "msg_box", "reply_path_present",
"m_cls", "read_status", "ct_t", "status", "retr_txt_cs",
"d_rpt", "error_code", "m_id", "date_sent", "m_type", "v",
"exp", "pri", "service_center", "address", "rr", "rpt_a",
"resp_txt", "locked", "resp_st", "m_size" };
String sortOrder = "date";
Uri uri = Uri.parse("content://mms-sms/conversations/");
Cursor c = contentResolver.query(uri, projection, null, null, sortOrder);

String messageDate = c.getString(c.getColumnIndex("date"));

MMS 的情况下,保存在 messageDate 变量中的纪元时间是 10 位数字长。但是,对于 SMS,保存在 messageDate 变量中的纪元时间为 13 位长。

当尝试按日期排序时,这会成为一个问题,因为按日期排序时,MMS 消息显示在 SMS 消息之前。

有什么方法可以查询此Content Provider 并获取按日期正确排序的所有消息(MMSSMS)?

最佳答案

看起来消息按日期排序的方法,不管消息是彩信还是短信,都是将排序顺序改为normalized_date,如下:

String sortOrder = "normalized_date";

关于android - MMS 和 SMS 之间的日期列长度不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14180082/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com