1694

Android How to get browser history records in all the browser apps?

Question:

I want to get all the browser history records from different browsers in android mobile phone? (Maybe as you know, there are usually more than one browser apps in a phone).

Answer1:

Assuming that all your browsers utilize this API to save history, this should be useful to you: <a href="http://developer.android.com/reference/android/provider/Browser.html" rel="nofollow">http://developer.android.com/reference/android/provider/Browser.html</a>. Otherwise, this is not practically possible.

Answer2:

You can do this in your Activity to get history record in android browser.

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

You may also need add blow permission to get history.

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

Recommend

  • Dynamic menu contribution with key bindings
  • Time complexity of zadd when value has score greater than highest score present in the targeted sort
  • Generating mandelbrot images in c++ using multithreading. No speedup?
  • Commands executed in PowerShell with variables surrounded in quotes fail. Why?
  • What does the first argument of the imp.load_source method do?
  • Abstract class in Swift
  • Javascript MIME
  • How to convert from one date format to another, in Microsoft SQL server?
  • Query timeout expired in django-mssql when executing custom SQL directly
  • Dynamically set LESS variables from user settings
  • Relative paths. baseUrl and paths not working on ionic2 - angular2
  • Pre-populated SQLite Database not reading properly in Android Studio
  • Converting query results into DataFrame in python
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • what makes a request a new request in asp.net C#
  • Possible to get mouse events fired when cursor is outside page?
  • accepts_nested_attributes_for practical form use for in Rails 3
  • GAE: Way to get reference to an HttpSession from its ID?
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • What is the purpose of TaskExecutor in spring?
  • System.InvalidCastException: Specified cast is not valid
  • PHP CURL timing out but CLI CURL works
  • With Hadoop, can I create a tasktracker on a machine that isn't running a datanode?
  • Why querying a date BC is changed to AD in Java?
  • Record samples being played with OpenAL
  • Read a local file using javascript
  • Asynchronous UI Testing in Xcode With Swift
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Why is an OPTIONS request sent to the server?
  • Projection media query: browser support and workarounds?
  • Apache 2.4 and php-fpm does not trigger apache http basic auth for php pages
  • Weird JavaScript statement, what does it mean?
  • jquery mobile loadPage not working
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • Turn off referential integrity in Derby? is it possible?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • JaxB to read class hierarchy