I use ContentObserver in my application. When the database to which I added the pointer to ContentObserver changes, the onChange() ContentObserver method is triggered, but it only lets you know that the database has been changed. Is it possible to somehow find out exactly which string was changed without checking the whole database?

    1 answer 1

    Only with API 16 can you get Uri records:

    public void onChange (boolean selfChange, Uri uri)

    • this is very bad, because my application should work on phones with min API 11 lvl - BORSHEVIK
    • I checked the URI that it returns. There is only Uri with the path to the database, but the DB string is not specified - BORSHEVIK
    • In order to have Uri records, you must specify Uri records when registering a listener. In the case of the contact database, there are ContactsContract.Contacts.CONTENT_LOOKUP_URI ... well, that is, in fact, you have to push each record by listener (or rather, the listener will be one, but there will be a lot of registrations) - Barmaley
    • Will it affect the performance? And another question, is it possible to stir up something like that on API lvl 11 or only API 16 and higher? - BORSHEVIK
    • And one more question. I do not change the database of contacts but periodically a message pops up in the logs that the database has been changed, what could be the reason? - BORSHEVIK 1:31 pm