Search code examples
androidbrowserbookmarksgalaxyandroid-contentresolver

Bookmark not visible in browser app after added via getContentResolver().insert(Browser.BOOKMARKS_URI, values);


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?


Solution

  • use Browser.savebookmark rather than using contentProvider.