title: getting the default and chrome browsers in android
body: <p>I have a code that retrieve the history of the default browser in android, lately I added the chrome browser history. But I have a problem- I get only the chrome history. E.g. if there is no chrome, I get the default browser, if there is chrome, both methods get the chrome only history.
  I use this code- </p>
  
  <pre><code>String[] mProjection = { 
              Browser.BookmarkColumns.BOOKMARK,
              BookmarkColumns.CREATED, BookmarkColumns.DATE,
              BookmarkColumns.TITLE, BookmarkColumns.URL,
              BookmarkColumns.VISITS, 
              BookmarkColumns._ID };  
      String mSelectionClause = "DATE &gt; ? ";
      String[] selectionArgs = {getEpochDate("DefaultBrowser")}; //"1332115200-000"
      String mSortOrder = "DATE";         
      Cursor cr = getContentResolver().query(Browser.BOOKMARKS_URI, mProjection, mSelectionClause, selectionArgs, mSortOrder);            
      cr.moveToFirst();           
      if (cr.moveToFirst() &amp;&amp; cr.getCount() &gt; 0) {
          while (cr.isLast() == false) {                          
              try {
                  if (cr.getString(cr.getColumnIndex("BOOKMARK")).equals("0")) {
                      Log.d("getHistory", cr.getString(cr.getColumnIndex("TITLE")));
                      mc.writeDataToDB("URL", mc.ConvertFromEpoch(cr.getString(cr.getColumnIndex("DATE"))), cr.getString(cr.getColumnIndex("URL")), cr.getString(cr.getColumnIndex("TITLE")),"");
                  }
              } catch (Exception e) {                     
                  e.printStackTrace();
              }               
              cr.moveToNext();
          }
          mc.insertPref("HistoryDate", cr.getString(cr.getColumnIndex("DATE")));  
      }   
  
      // get google chrome history
  
      String[] selectionArgsChrome = {getEpochDate("ChromeBrowser")};
  
      Uri uriCustom = Uri.parse("content://com.android.chrome.browser/bookmarks");
      if (getContentResolver().query(uriCustom, mProjection, mSelectionClause, selectionArgsChrome, mSortOrder) !=null){
      Cursor mCur = getContentResolver().query(uriCustom, mProjection, mSelectionClause, selectionArgsChrome, mSortOrder);
  
      mCur.moveToFirst();
      String title = "";
      String url = "";
      String DATE = "";
  
      if (mCur.moveToFirst() &amp;&amp; mCur.getCount() &gt; 0) {
      boolean cont = true;
       while (mCur.isAfterLast() == false &amp;&amp; cont) {
              title = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.TITLE));
              url = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.URL));
              DATE =  mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.DATE));
              mc.writeDataToDB("URL", mc.ConvertFromEpoch(DATE), url, title,"");
              mCur.moveToNext();
      }
       mc.insertPref("ChromeHistoryDate", cr.getString(cr.getColumnIndex("DATE")));   
      }}
  </code></pre>
  
  <p>can I get the default browser and then the chrome? I did try to change the "Browser.BOOKMARKS_URI" to uri- "content://com.android.browser/bookmarks", but it didn't worked.</p>
  
  <p>any suggestions?</p>