为什么联系人不聚合

为什么联系人不聚合

本文介绍了为什么联系人不聚合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序允许编辑联系人.在这种情况下,我选择了仅存在于一个帐户中的联系人,并将其更改为与三个帐户相关联.但是,我最终得到了两个联系人,而不是一个,如下面的ContactsContract转储所示.提供者为什么不汇总它们?

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 two contacts, not one, as shown in the ContactsContract dump below. Why didn't the provider aggregate them?

agg 1821, display "A Z1", key 770i236434918d3893ea.2709i79dde86f8c1565d3.2709i506dc01a0d43d677.2709i4707c358f8fb503
  raw 1821, acct type com.google, acct name [email protected]
    data 10338, display "A Z1"
    data 10343, phone 123456, Pager
    data 10349, phone 545, Fax Work

agg 1861, display "A Z1", key 1780r1860-q29pq04pq5Bpq16p.2709r1861-q29pq04pq5Bpq16p
  raw 1860, acct type com.fusionone.account, acct name Backup Assistant
    data 10580, display "A Z1"
    data 10582, phone 123456, Pager
    data 10584, phone 545, Fax Work

  raw 1861, acct type com.google, acct name [email protected]
    data 10581, display "A Z1"
    data 10583, phone 123456, Pager
    data 10585, phone 545, Fax Work

在此转储中,三层代表汇总联系人行,原始联系人行和联系人数据行.前导词(例如agg 1821)旁边的数字是_ID列值. 显示"代表DISPLAY_NAME.

In this dump, the three tiers represent the aggregate contact rows, the raw contact rows, and the contact data rows. The number next to the leading word (e.g. agg 1821) is the _ID column value. "display" represents DISPLAY_NAME.

更具体地说,我从agg 1821开始,它来自帐户[email protected](混淆).然后,我使用与agg 1821相同的显示名称为其他两个帐户创建了两个新的原始联系人(1860和1861).您可以看到结果:这两个新的原始联系人被聚合在一起,但是该对未与原始联系人聚合. (1821)联系人.

More specifically, I started with agg 1821 which comes from account [email protected] (obfuscated). Then I created two new raw contacts (1860 and 1861) for two other accounts, using the same display name as for agg 1821. You can see the results: the two new raw contacts were aggregated together but the pair was not aggregated with the original (1821) contact.

推荐答案

如果您希望RawContacts通过写入 AggregationExceptions :

为每对创建一个操作:

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();

然后执行所有操作的ArrayList:

ContentProviderResult[] res = resolver.applyBatch(ContactsContract.AUTHORITY, operationList);

res将包含有关所有操作成功/失败的信息

res will contain info about the success/failure of all operations

这篇关于为什么联系人不聚合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 05:18