这两天,被测试同事的华为荣耀8搞得焦头烂额,在其他手机能正常使用的Uri,在它身上却问题多多,不得不去吐槽国内定制系统…
一开始,我的搜索操作是这样的…
private void query(String keyword) {
Uri searchUri = Telephony.MmsSms.SEARCH_URI.buildUpon().appendQueryParameter(“pattern”, keyword).build();
mQueryHandler.startQuery(0, null, searchUri, null, null, null, null);
}
虽然,这只能模糊搜索信息的内容并不能根据联系人号码去查询,手中的一加、小米手机运行是没问题的,但…华为手机运行后,得到的cursor是null…
好吧,既然这样,我换个Uri试试…
content://mms-sms/conversations/
先在自己手机测下,看是否可以查询成功…OK,可以,再借同事手机来跑下…结果,崩溃了,日志如下:
android.database.sqlite.SQLiteException: no such column: group_all (Sqlite code 1): , while compiling:
SELECT thread_id, address, body, date, _id FROM (
SELECT thread_id AS tid, date * 1000 AS normalized_date, NULL AS time_body, text_only, NULL AS group_id, ct_t, msg_box, v, retr_txt_cs, ct_cls, NULL AS type, st, NULL AS address, NULL AS person, tr_id, read, m_id, NULL AS body, NULL AS addr_body, m_type, network_type, locked, resp_txt, retr_st, NULL AS error_code, NULL AS group_all, NULL AS reply_path_present, sub, NULL AS risk_url_body, rr, ct_l, NULL AS status, NULL AS subject, _id, m_size, exp, sub_cs, NULL AS group_fail, sub_id, resp_st, date, date_sent, pri, NULL AS group_sent, thread_id, read_status, d_rpt, rpt_a, NULL AS is_secret, m_cls, NULL AS service_center FROM pdu WHERE ((msg_box != 3 AND (m_type = 128 OR m_type = 132 OR m_type = 130))) GROUP BY thread_id HAVING date = MAX(date) UNION SELECT thread_id AS tid, date * 1 AS normalized_date, time_body, NULL AS text_only, group_id, NULL AS ct_t, NULL AS msg_box, NULL AS v, NULL AS retr_txt_cs, NULL AS ct_cls, type, NULL AS st, address, person, NULL AS tr_id, read, NULL AS m_id, body, addr_body, NULL AS m_type, network_type, locked, NULL AS resp_txt, NULL AS retr_st, error_code, group_all, reply_path_present, NULL AS sub, risk_url_body, NULL AS rr, NULL AS ct_l, status, subject, _id, NULL AS m_size, NULL AS exp, NULL AS sub_cs, group_fail, sub_id, NULL AS resp_st, date, date_sent, NULL AS pri, group_sent, thread_id, NULL AS read_status, NULL AS d_rpt, NULL AS rpt_a, is_secret, NULL AS m_cls, service_center FROM sms_secret WHERE ((type != 3)) GROUP BY thread_id HAVING date = MAX(date)) GROUP BY tid HAVING normalized_date = MAX(normalized_date), (OS error – 2:No such file or directory)
无法找到group_all这列…就在这时,我开始强迫症了,Google了整整几小时,找到的资料少之又少,只有在GitHub的一个Issue中看到了相同问题(https://github.com/WhisperSystems/Signal-Android/issues/6198),但是并没有解决方法,好吧,好吧…
于是又试了几个Uri,但还是崩溃报Unrecognized URI!错误…
content://mms-sms/
content://mms-sms/messages/byphone
*后,实在没办法只能放弃彩信的搜索,只允许用户搜索Sms而不是Mms-Sms:
content://sms/inbox
不得不感概:兼容问题,是一个大问题啊!!!