我试图读取日期后收到的所有短信。在日期后收到短信
下面是代码:
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