Not able to get SAMSUNG S4 native browser history

2019-04-09 21:13发布

问题:

I am accessing the browser history from device native browser. I use following code -

Cursor cur = getContentResolver().query(Browser.BOOKMARKS_URI,
            new String[] { Browser.BookmarkColumns.URL }, null, null,
            BookmarkColumns.DATE + " DESC");

It works fine in all devices, but in SAMSUNG S4 Cursor returns null. I find that in devices where i get proper response, Browser package is 'com.android.browser' but in S4 device it is 'com.sec.android.app.sbrowser'. Is that the issue? But this is native browser in Samsung S4.

Thanks in advance.

回答1:

Try this-

Uri uri = Uri.parse("content://com.sec.android.app.sbrowser.browser/history"); instead of Browser.BOOKMARKS_URI.