我正在尝试阅读约会后收到的所有短信.
这是代码:
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
Run Code Online (Sandbox Code Playgroud)
这会返回一个空光标.
当我执行此代码时:
Cursor cursor = context.getContentResolver().query( SMS_INBOX_CONTENT_URI, new String[] { "_id" }, "read=1", null, null);
Run Code Online (Sandbox Code Playgroud)
把我所有的短信归还给我.
有人知道如何按日期过滤短信吗?
我试图在发送短信执行,但有同样的问题.