Question

In Android, how can I observe for any changes made to a contact? I know I need to register for a content observer? But what should be the URI for passing to the registerContentObserver function?

Here is what I tried:

registerContentObserver( ContentUris.withAppendedId(People.CONTENT_URI, personId), true, myContactsObserver);

But I don't get notified when I change the phone number of the contact.

Thank you for any pointers.

Was it helpful?

Solution

More information would make it easier to figure out.

I wonder if it's because your Activity is no longer running when the contact changes. If you're changing the contact through the built-in Contacts application, that would imply that your activity is no longer at the top of the stack, so there's no guarantee that it's still resident.

You might try registering the contact observer in a service that you explicitly start and stop.

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