Question

how to be notified about bookmark add or remove?

Using...

ContentResolver resolver = context.getContentResolver();
resolver.registerContentObserver(android.provider.Browser.BOOKMARKS_URI, **FALSE**, this);

...the onChange() callback is called when a new bookmark is added but not when a preexistent bookmark is removed.

otherwise using...

ContentResolver resolver = launcher.getContentResolver();
resolver.registerContentObserver(android.provider.Browser.BOOKMARKS_URI, **TRUE**, this);

...the onChange() callback is called continuosly... even if i've only navigated from a web to another.

I'd like only to be notified when at the bookmark table a record is added or deleted.

Thanks in advice L.

Was it helpful?

Solution

You can find the count of the bookmark db and save it in file, preference or database as you find change you should again calculate count and compare with previous. If new count is greater its mean addition and if less its mean deletion and if same means modification occurred.

I hope this will clear your direction or at least help you.

Yours

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top