how to get current URL from Browser in API 23?

≯℡__Kan透↙ 提交于 2020-01-01 07:19:05

问题


how to get current URL from Browser in API 23. I tried to use Browser.BookmarkColumns, but it was removed from API 23. thanks in advance

public String chromeHistory(){ 
        String[] proj = new String[]{"title","url"};
        Uri uriCustom = Uri.parse("content://com.android.chrome.browser/bookmarks");
        String sel = "bookmark = 0";
        Cursor mCur = getContentResolver().query(uriCustom, proj, sel, null, "date"+" ASC");
        String url = "";
        if (mCur.moveToFirst()){
            do{
                url = mCur.getString(mCur.getColumnIndex("url"));
            }while(mCur.moveToNext());
        }
        mCur.close();
        return url;
    }

In API 23 it does not return any url, but below API23 it returns browsing url. Please help me. I was struck in this for past one day

来源:https://stackoverflow.com/questions/33213081/how-to-get-current-url-from-browser-in-api-23

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!