4

According to the official documentation, when there is a new RawContact inserted to the contact's database, the system initiates the mechanism of aggregation to find a Contact which the inserted RawContact will be aggregated with.

In the case of presence similar contact information in the contacts database the inserted RawContact will be aggregated with the existing Contact and in the case of absence of such information the system will create a new Contact and will aggregate the inserted RawContact with it.

I have already looked through the ContactsContract.AggregationExceptions and ContactsContract.Contacts.AggregationSuggestions but haven't found any information which could help me to figure out how to forcibly tell the system to create a new Contact when I insert a new RawContact in my application.

If anybody knows how to do that, I would be glad to get your suggestions.

Thanks

4

1 回答 1

4

要创建新联系人,请插入ACCOUNT_NAMEACCOUNT_TYPEin的值ContactsContract.RawContacts并获取新行的_ID. 然后在插入联系人数据时使用它_ID来填写。RAW_CONTACT_IDContactsContract.Data

_ID的 inContactsContract.RawContacts不应该已经存在,因此在插入/更新相应的数据之前不会聚合ContactsContract.Data

ContactsContract.Contacts只是一个自动聚合表,以简化数据查询。你不应该直接改变它。

于 2013-01-18T09:16:44.040 回答