0

I add a bookmark with the following code:

ContentValues values = new ContentValues();

        values.put(Browser.BookmarkColumns.TITLE, "bookmark title");
        values.put(Browser.BookmarkColumns.URL, "http://www.someurl.com/");
        values.put(Browser.BookmarkColumns.BOOKMARK, 1);
        values.put(Browser.BookmarkColumns.CREATED, System.currentTimeMillis());
        values.put(Browser.BookmarkColumns.DATE, 0L);
        values.put(Browser.BookmarkColumns.VISITS, 0);

        getContentResolver().insert(Browser.BOOKMARKS_URI, values);

If I run this on an HTC Sensation device, I can see the new bookmark in the bookmarks app.

If I run it on a Samsung Galaxy S (1 or 2) however, the bookmark is not there.

I know that it is added successfully to the db (I query all of the bookmarks and it is there), but I don't get why can't I actually see it among the other bookmarks in the browser app.

Any thoughts?

dors
  • 5,802
  • 8
  • 45
  • 71
  • The API exposed by `BookmarkColumns` isn't the "actual" thing on ICS - there are more columns - defined in the _hidden_ API `BrowserContract` - it could be using a specific account (yup, there are accounts now) for it's browser - or, if it's really odd - a specific folder. – Jens Aug 16 '12 at 13:04

1 Answers1

0

use Browser.savebookmark rather than using contentProvider.

nandeesh
  • 24,740
  • 6
  • 69
  • 79
  • I need to add the bookmark without user interaction, so savebookmark() is not what I am looking for... – dors Aug 16 '12 at 12:48
  • i think there is one more column called folder which needs to be set. When you query just do a trial and error to find all columns and check the folder for all that are visible – nandeesh Aug 16 '12 at 12:56
  • That worked! Thanks :) all of the bookmarks are added to folder 0, and the default is apparently 99. the question is, why is this undocumented AND how can this affect different Android operation systems – dors Aug 16 '12 at 13:02
  • i think it is only for samsung phones. So check if folder column is present and update only if it is present – nandeesh Aug 16 '12 at 13:02
  • @dors i am facing the same issue please tell me how you resolve this ? – Supreet Aug 23 '13 at 07:55