why won't contacts aggregate?

前端 未结 1 1320

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

相关标签:
1条回答
  • 2020-12-12 06:00

    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

    0 讨论(0)
提交回复
热议问题