I would like to insert RawContact records to provide supplementary data for contacts. I use the AggregateExceptions table to link the real RawContact with mine.
I'd like to know how can I automatically delete my RawContact when the original is removed. (the user deleted someone using the Google Contacts webapp).
It seems that the Viber app somehow manages to do this, so there must be a way.
As noted in the SyncAdapter docs, if you set
android:supportsUploading="true"
in your sync adapter descriptor, your adapter will be called if there's a change in the corresponding content provider. This seems to work, however the sync adapter is not called immediately.
So I set up a SyncAdapter for the com.android.contacts
authority, and when onPerformSync
is called, I check if there is a RawContact that needs to be removed.