我也想访问短信日志。但我没有找到任何方法,我已经使用 CallLog.Calls 访问了通话记录,它无法列出短信记录。下面的代码仅列出通话日志,但并非所有日志甚至短信日志都没有列出(短信日志表示由于接收和发送短信而创建的日志)。请帮我找到找回短信日志的方法。如果可能的话,请先生。
Cursor cursor = managedQuery(CallLog.Calls.CONTENT_URI, null, null,
null, Calls.DATE + " DESC");
// cursor is inited
cursor.moveToFirst();
String name;
String number;
int type;
do {
name = "";
number = "";
type = -1;
try {
number = cursor.getString(cursor
.getColumnIndex(CallLog.Calls.NUMBER));
type = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.TYPE));
try {
name = cursor.getString(cursor
.getColumnIndex(CallLog.Calls.CACHED_NAME));
} catch (Exception e) {
} finally {
if (name == null || name.equals("")) {
name = "UNKNOWN";
}
}
Log.e("My App", name + " : "+number + " : "+type);
} catch (Exception e) {
Log.e("My App", "Error in creation");
}
} while (cursor.moveToNext());