android中的短信内容提供商?

时间:2012-04-13 08:55:28

标签: android android-contentprovider

SMS内容提供商中的Timestamp和Date列之间的区别是什么?任何人都可以告诉我如何获取基于指定日期的消息列表?

1 个答案:

答案 0 :(得分:0)

这里有关于列的详细信息:(但是,它实际上取决于URI,您将用于查询) http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.7_r1/android/provider/Telephony.java#Telephony.TextBasedSmsColumns

The date the message was sent
Type: INTEGER (long)
public static final String DATE = "date";

获取给定日期的消息的代码(您需要READ_SMS权限):

final Cursor myMessages = context.getContentResolver().query(Uri.parse("content://sms"), new String[] { "address", "_id", "body", "type", "date", "read", "thread_id" }, "date > your_timestamp", null, "date ASC");