I'm working on an app which Syncs contacts with a backend. When you delete the app the contacts will be deleted, but when you re-install the app the contacts will be restored from the backend.
After initial sync I don't want the contacts to be synced again because no data has changed. Therefore I use uri.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true");
when inserting a restored RawContact.
But the Dirty flag is still set to 1, so the contacts will be unnecessary synced back again. How can I prevent this?
I even set builder.withValue(ContactsContract.RawContacts.DIRTY, 0);
the dirty field to 0 when inserting but this does not help.
I thought of adding a custom data for a initialsync flag, but the editing of the contacts can be done outside of the app so I can't set this to false when someone edits the contact outside of the app.