can we get chrome browsing history/bookmarks like we get in default browser using READ_HISTORY_BOOKMARKS permission? PS:I Just want to know is it possible?
FAQs. Can I sync my Chrome bookmarks on any device? As long as your device can run the Chrome browser, you can sync your bookmarks to it. This includes Android, iOS, Windows, and macOS.
Similarly to the iPhone step above, it's not possible to export your Chrome bookmarks directly from within your Chrome app on Android. The easiest way to access your Android Chrome bookmarks on another device is to sync them with your Google account.
Yes it is very much possible.
Use this uri: content://com.android.chrome.browser/bookmarks
instead of Browser.BOOKMARKS_URI
String[] proj = new String[] { Browser.BookmarkColumns.TITLE,Browser.BookmarkColumns.URL };
Uri uriCustom = Uri.parse("content://com.android.chrome.browser/bookmarks");
String sel = Browser.BookmarkColumns.BOOKMARK + " = 0"; // 0 = history, 1 = bookmark
Cursor mCur = getContentResolver().query(uriCustom, 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();
}
}
Havent tested the code for errors but it should work fine. The important thing is knowing the uri to use. Reading this and this might help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With