n179911
n179911

Reputation: 20301

How can I observe for any changes to a contact

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.

Upvotes: 0

Views: 850

Answers (1)

Daniel Yankowsky
Daniel Yankowsky

Reputation: 7006

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.

Upvotes: 2

Related Questions