在 Android 2.0 或更高版本中,是否可以识别形成单个聚合联系人的所有原始联系人?
据您所知,Android V2.x 中存在由两个或多个原始联系人聚合形成的联系人(聚合联系人),
是否可以通过查询识别形成单个聚合联系人的所有原始联系人在 ContactsContract.Contacts 上或者有没有办法识别这些 到底有没有联系?
我找不到任何标志或数据库字段告诉我此聚合联系人与这些原始联系人相关联。
有什么建议吗?
as far as you might know, there are contacts (aggregate contacts) which are formed by aggregation of two or more raw contacts in Android V2.x
is it possible to identify all the raw contacts from which a single aggregate contacts is formed through a query on the ContactsContract.Contacts or is there a way to identify these
contacts at all?
i could not find any flag or database field that tells me that this aggregate contacts is linked with these raw contacts.
any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以检查关系类型为
AggregationExceptions.TYPE_KEEP_TOGETHER
、AggregationExceptions.TYPE_KEEP_SEPARATE
等的AggregationExceptions.CONTENT_URI
表,可以找到
Raw_contact_id1
和raw_contact_id2
。数据存入数据库的示例。假设 1、2、3、4 是相关的,因此您可以找到以下对。
Raw_contact_id1
raw_contact_id2
关系类型1-> 2、1→3、1→4、2→3、2→4、3→4
You can check
AggregationExceptions.CONTENT_URI
Table where relationship type areAggregationExceptions.TYPE_KEEP_TOGETHER
,AggregationExceptions.TYPE_KEEP_SEPARATE
, etc.and you can find
Raw_contact_id1
andraw_contact_id2
.Example of data into database. Lets say 1,2,3,4 are in relation so you can find following pairs.
Raw_contact_id1
raw_contact_id2
Relationship type1-> 2, 1->3, 1->4, 2->3, 2->4, 3->4
无法显式创建联系人。插入原始联系人时,提供程序将首先尝试查找代表同一个人的联系人。如果找到,原始联系人的 CONTACT_ID 列将获取聚合联系人的 _ID。如果未找到匹配项,提供程序会自动插入新联系人并将其 _ID 放入新插入的原始联系人的 CONTACT_ID 列中。
因此,在一一读取所有联系人时,我们可以获取其 _ID 值,并可以从 raw_contacts 中检索所有联系人,其中 _ID 与 raw_contacts.CONTACT_ID 匹配。
如果计数大于 1,则我们可以得出结论,它与这些数量的联系人相关联,否则它不与任何其他联系人相关联。
A Contact cannot be created explicitly. When a raw contact is inserted, the provider will first try to find a Contact representing the same person. If one is found, the raw contact's CONTACT_ID column gets the _ID of the aggregate Contact. If no match is found, the provider automatically inserts a new Contact and puts its _ID into the CONTACT_ID column of the newly inserted raw contact.
So, while reading all the contacts one by one we can take its _ID value and can retrieve all the contacts from raw_contacts where _ID matches with raw_contacts.CONTACT_ID.
If the count is greater than 1 then we can conclude that it is linked with those numbers of contacts else it is not linked with any other contact.