[android] get browser history

CursorLoader cursorLoader = new CursorLoader(this, Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, null);
Cursor cursor = cursorLoader.loadInBackground();

if (cursor.getCount() == 0)
	return;

cursor.moveToFirst();
Calendar cal = Calendar.getInstance();

while (cursor.isAfterLast() == false)
{
	String id = cursor.getString(Browser.HISTORY_PROJECTION_ID_INDEX);
	String title = cursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX);
	String date = cursor.getString(Browser.HISTORY_PROJECTION_DATE_INDEX);
	String visits = cursor.getString(Browser.HISTORY_PROJECTION_VISITS_INDEX);

	if (date == null)
	{
		Log.w("###", id + " | " + title + " | " + visits + " | bookmark");
	}
	else
	{
		long dateTime = Long.parseLong(date);
		cal.setTimeInMillis(dateTime);
		Log.w("###", id + " | " + title + " | " + visits + " | " + cal.getTime().toString());
	}

	cursor.moveToNext();
}

 

<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />

 

 

result

102 | 호호호 - Google 검색 | 1 | Sat Nov 02 11:08:51 GMT+09:00 2013
103 | youtube - Google 검색 | 1 | Sat Nov 02 11:09:00 GMT+09:00 2013
2 | 모가조아 | 0 | bookmark
3 | 네이버 | 0 | bookmark
4 | 다음 | 0 | bookmark
5 | 구글 | 0 | bookmark
6 | 네이트 | 0 | bookmark
7 | LG U+ | 0 | bookmark

 

 

만약 접속 기록을 삭제하면 아무 것도 나오지 않는다.