新创建联系人的指示器

发布于 2024-12-02 00:39:01 字数 365 浏览 4 评论 0原文

除了 RawContacts.VERSION 和 RawContacts.DIRTY 之外,是否还有任何指示符可以告诉我是否已创建新联系人?

现在,我检查联系人数据库中的“脏”联系人,然后如果版本字段大于二,则它是已更改的联系人,否则它是新联系人。

但现在我遇到的问题是,如果我的 SyncAdapter 由于网络问题或服务器问题而无法同步此新联系人,那么如果用户再次更改联系人,在我的 SyncAdapter 有第二次机会上传它之前,我可能会错过它。因为这样 VERSION 字段将大于 2,并且我的同步适配器无法识别该联系人是新联系人。

我检查了两次参考文献,但找不到任何表明它的字段。

任何提示都将受到高度赞赏。

干杯, 阿里3n

Is there any indicator besides RawContacts.VERSION and RawContacts.DIRTY that tells me if a new contact has been created?

Right now I check the contactdatabase for "DIRTY"-contacts and then if the VERSION field is greater two it's a changed contact otherwise it is a new one.

But now I have the problem that if my SyncAdapter fails to sync this new contact due to network problems or server problems I could miss it, if the user change the contact again, befor my syncadapter gets a second chance to upload it. Because then the VERSION field will be greater than two and my syncadapter fails to recognize that this contact is a new one.

I checked the references twice, but can't find any field that would indicate it.

Any hint is highly appreciated.

Cheers,
Ali3n

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苏佲洛 2024-12-09 00:39:01

我想我找到了丢失的拼图:RawContacts.SOURCE_ID

文档说:

唯一标识该行到其源帐户的字符串。
通常它是在插入原始触点时设置的,并且永远不会
后来改变了。一个值得注意的例外是新的原始联系人:它
将有一个帐户名称和类型(可能还有一个数据集),但没有
源 ID。这向同步适配器表明新联系人需要
服务器端创建,其ID存放在对应的
电话上的 SOURCE_ID 字段。电话上的 SOURCE_ID 字段。

I think I found the missing puzzlepiece: RawContacts.SOURCE_ID

Documentation says:

String that uniquely identifies this row to its source account.
Typically it is set at the time the raw contact is inserted and never
changed afterwards. The one notable exception is a new raw contact: it
will have an account name and type (and possibly a data set), but no
source id. This indicates to the sync adapter that a new contact needs
to be created server-side and its ID stored in the corresponding
SOURCE_ID field on the phone.SOURCE_ID field on the phone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文