我試圖讀取日期後收到的所有短信。在日期後收到短信
下面是代碼:
Uri SMS_CONTENT_URI = Uri.parse("content://sms");
Uri SMS_INBOX_CONTENT_URI = Uri.withAppendedPath(SMS_CONTENT_URI, "inbox");
Cursor cursor = context.getContentResolver().query(SMS_INBOX_CONTENT_URI, new String[] { "_id" }, "date>=61291393200000", null, null);
//61291393200000 = 03/01/12
這將返回我一個空指針。
當我執行此代碼:
Cursor cursor = context.getContentResolver().query(SMS_INBOX_CONTENT_URI, new String[] { "_id" }, "read=1", null, null);
返航我所有的短信。
有人知道如何按日期篩選短信?
我試圖在發送短信中執行,但也有同樣的問題。
我不再使用該項目,但代碼對我來說似乎沒問題。因此,我接受了答案。 – jonathanrz 2013-12-01 17:46:02