Why Won't Contacts Aggregate?
My app allows editing contacts. In this scenario, I chose a contact which existed in only one account and changed it to associate it with three accounts. However, I ended up with t
Solution 1:
Don't assume the system to aggregate similar contacts, if you want RawContacts
to join force aggregation by writing to AggregationExceptions:
for each pair, create an operation:
Builder builder = ContentProviderOperation.newUpdate(AggregationExceptions.CONTENT_URI);
builder.withValue(AggregationExceptions.TYPE, AggregationExceptions.TYPE_KEEP_TOGETHER);
builder.withValue(AggregationExceptions.RAW_CONTACT_ID1, raw1);
builder.withValue(AggregationExceptions.RAW_CONTACT_ID2, raw2);
ContentProviderOperation op = builder.build();
Then execute an ArrayList
of all operations:
ContentProviderResult[] res = resolver.applyBatch(ContactsContract.AUTHORITY, operationList);
res
will contain info about the success/failure of all operations
Post a Comment for "Why Won't Contacts Aggregate?"