0

I'm developing an app that shows ads as banners.

There's an option to request those ads with content URL.

If i give a URL with a content that the user is interested in the ads will be better for the user. My Question - how can i monitor the user's visited URL's? Do i need an extra permission?

Thanks

1 Answers1

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

You need to add into AndroidManifest.xml

For Lollipop and above

Cursor mCursor = activity.managedQuery(Browser.BOOKMARKS_URI,
                    Browser.HISTORY_PROJECTION, null, null, null);
            if (mCursor .moveToFirst()) {
                while (mCursor .isAfterLast() == false) {
                    Log.v("titleIdx", mCursor 
                            .getString(Browser.HISTORY_PROJECTION_TITLE_INDEX));
                    Log.v("urlIdx", mCursor 
                            .getString(Browser.HISTORY_PROJECTION_URL_INDEX));
                    mCursor .moveToNext();
                }
            }

Use this you can access browsing history.

paranjothi
  • 103
  • 6
  • Hi, I've tried it but all static fields of the Browser class can not be resolved. I've checked and i have the import of the browser class. My target and compile sdk are both 26 And the minimum is 16 – Gili Robinzon Jan 17 '18 at 09:54
  • 1
    See this answer :- https://stackoverflow.com/questions/33486463/how-to-get-chrome-history-bookmarks-in-android-marshmallow-api-23/33486978 – prakash singh Jan 19 '18 at 06:49