0

I have been rooting around in the framework on ICS, and it appears that the ContactsProvider2, in the Android Contacts Provider, calls notifyChange after any insert/update, not only that, it does it by:

NotifyChange(ContactsContract.AUTHORITY_URI, null, syncToNetwork);

That means that ANY insert/update/delete on the contacts AUTHORITY Uri triggers content observers to get an update. While in theory, this is pretty good.. It appears that it also gets triggered by way of Presence updates.

If I try to pull a cursor on the Data table, it too links the data table to presence, and any updates to presence have onLoadFinished to get called (CursorLoader).

Looking into the cursor issue, it looks like it is because the ContactsProvider2 calls

setTablesAndProjectionMapForData() 

which in turn appends Presnce/status columns to every data row.

appendContactPresenceJoin(sb, projection, RawContacts.CONTACT_ID);
appendContactStatusUpdateJoin(sb, projection, ContactsColumns.LAST_STATUS_UPDATE_ID);
appendDataPresenceJoin(sb, projection, DataColumns.CONCRETE_ID);
appendDataStatusUpdateJoin(sb, projection, DataColumns.CONCRETE_ID);

Is there any way to register a content Observer to get updates on the Data table changing w/out actually getting updates for Presence changes? I believe presence used to be excluded from Data.CONTENT_URI queries in 2.3 / 3.x.. But looks like it has changed..

Charles
  • 50,943
  • 13
  • 104
  • 142
Chrispix
  • 17,941
  • 20
  • 62
  • 70

1 Answers1

0

What about CONTENT_VCARD_URI?

AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
  • Don't think this would work, as this references a single contact. My issue was in an enterprise setting. A bit difficult to explain, but we had a provider which aggregated asynchronously multiple results from off and on device resources, each time one returned it would notify a change. For on device, we accessed this list via cursor loader. But notification updates would keep streaming in, and causing us to try and re-merge with other data in db.. Overly complicated use case, I don't remember the solution we did now.. – Chrispix Aug 21 '15 at 15:27