0

I have used the Browser class to access the browsing history for my app. I just need to log/save this data. However the Android Browser class only give the browsing history of the default browser. Is it possible for me to get the browsing history in all the browsers installed in my android device.

Write now my code is as follows.

private String getBrowserInfo() {
    StringBuffer stringBuffer = new StringBuffer();
    String[] proj = new String[]{Browser.BookmarkColumns.TITLE, Browser.BookmarkColumns.URL};
    String sel = Browser.BookmarkColumns.BOOKMARK + " = 0"; // 0 = history, 1 = bookmark
    Cursor mCur = context.getContentResolver().query(Browser.BOOKMARKS_URI, proj, sel, null, null);
    mCur.moveToFirst();
    @SuppressWarnings("unused")
    String title = "";
    @SuppressWarnings("unused")
    String url = "";
    if (mCur.moveToFirst() && mCur.getCount() > 0) {
        boolean cont = true;
        while (mCur.isAfterLast() == false && cont) {
            title = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.TITLE));
            url = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.URL));
            // Do something with title and url
            mCur.moveToNext();
            stringBuffer.append("\nTitle:--- " + title + " \n" +
                    "URL:--- " + url);
            stringBuffer.append("\n----------------------------------");
        }
    }
    return stringBuffer.toString();
}
Raptor
  • 53,206
  • 45
  • 230
  • 366
user77005
  • 1,769
  • 4
  • 18
  • 26

0 Answers0