简体   繁体   English

在Windows Phone通讯簿中唯一标识联系人

[英]Uniquely identifying contacts in a Windows Phone Address Book

Consider the following situation: 请考虑以下情况:

  • I save data from a random Contact X from the address book into Iso Storage 我从通讯录中将来自随机Contact X的数据保存到Iso Storage中
  • I leave the application and modify Contact X in the address book 我离开应用程序并修改通讯录中的Contact X
  • Coming back to the application, how can I identify that Contact X from Iso Storage is the same as Contact X that I just modified in the address book? 回到该应用程序,如何确定Iso Storage中的Contact X与我刚刚在通讯簿中修改的Contact X相同?

My intention is to periodically copy a user's address book data into Iso Storage and then sync it with a server. 我的目的是定期将用户的通讯簿数据复制到Iso Storage中,然后将其与服务器同步。 I'm only doing READ operations, which are fully permitted, if given authorization. 如果获得授权,我只会执行完全允许的READ操作。

The problem is that the Contact ID is a private field, and I cannot use Contact Stores (which have public IDs). 问题是联系人ID是一个私有字段,我不能使用联系人存储(具有公共ID)。

Also, WP Contacts don't have content rules, meaning you can have contact with no name, with 10 phone numbers, with no phone numbers, etc, so taking a piece of content as a unique identifier will not work since consistency is not guaranteed. 另外,WP联系人没有内容规则,这意味着您可以不带姓名,10个电话号码,不带电话号码等进行联系,因此无法保证将内容作为唯一标识符使用,因为不能保证一致性。

Hash Codes will also not work since the a modified object results in a modified has code. 哈希代码也将不起作用,因为修改后的对象会导致修改后的has代码。

Any help is much appreciated. 任何帮助深表感谢。

Found an answer - thanks to a related question posted here. 找到了答案-感谢此处发布的相关问题。

I decompiled the Microsoft.Phone DLL and it seems that Contact.GetHashCode actually returns the Contact.ID value. 我反编译了Microsoft.Phone DLL,似乎Contact.GetHashCode实际上返回了Contact.ID值。 Behavior has been confirmed to work as expected on various devices and on the emulator. 已经确认行为可以在各种设备和仿真器上正常运行。

All those people who consistently insist that developers should not be allowed access to information such as the contact ID - please bear in mind that users Contact Access permission can be denied in the marketplace. 所有始终坚持不应该允许开发人员访问联系人ID之类的信息的人-请记住,用户在市场中的“联系人访问”权限可能会被拒绝。 When I'm developing, I'm assuming the user fully understands what he's getting himself into, since I take the time and write a meaningful description and MS does good acceptance testing. 当我进行开发时,我假设用户完全理解了自己的想法,因为我花时间写了有意义的描述,并且MS进行了良好的验收测试。 If the user suddenly realities the app "breaks his privacy" IT'S NOT MY PROBLEM AS A DEVELOPER. 如果用户突然意识到应用程序“破坏了他的隐私”,那么作为开发人员这不是我的问题。

The last paragraph is motivated by the fact that I saw a couple of answers formulated something like "devs don't need these features, they break privacy". 最后一段是基于这样一个事实的:我看到了一些答案,这些答案表达为“开发人员不需要这些功能,它们会破坏隐私”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM