Android 1.x Contacts.Extensions 用于自定义帐户类型?

发布于 2024-09-30 01:01:50 字数 600 浏览 5 评论 0原文

我正在编写一个具有联系人同步功能的社交网络应用程序。我有工作代码(从我发现的示例 此处)将 v2.x 上的联系人插入同步适配器中。

但是,Motorola Blur 软件无法识别 2.x 联系人(我使用的是基于 Droid X 构建的 2.2 Moto)。 Blur 使用联系人 1.x API,但我无法找到/理解如何使用它的示例。 此页面显示如何按名称查询,但我想a)添加b) 通过自定义帐户(或可能的 MIME)类型进行查询。

我使用的 v2 代码创建一个新的原始联系人,创建一个“StructuredName”数据记录,然后创建一个自定义 MIME 类型的数据记录。

如何在 1.x API(级别 3)上执行等效操作?我认为这就是 Contacts.Extensions 类的用途,但文档充其量不清楚。

I'm writing a social networking app that has contacts sync functionality. I have working code (from an example I found here) that inserts contacts on v2.x in a sync adapter.

However, the Motorola Blur software doesn't recognize 2.x contacts (I'm using a 2.2 Moto build on a Droid X). Blur uses the contacts 1.x API, but I'm having trouble finding/understanding examples of how to use it. This page shows how to query by name, but I want to a) add and b) query by a custom account (or potentially MIME) type.

The v2 code I'm using creates a new raw contact, creates a "StructuredName" data record, and then a data record of custom MIME type.

How do I do the equivalent on the 1.x API (level 3)? I think that this is what the Contacts.Extensions class is for, but the documentation is unclear at best.

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

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

发布评论

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

评论(2

岁月苍老的讽刺 2024-10-07 01:01:50

Motorola BLUR 对联系人的修改更多地与设备上的帐户管理方式有关,而与内容提供商的更改关系不大。使用 Motorola BLUR 设备时的真正问题是,您需要将 ACCOUNT_NAMEACCOUNT_TYPE 设置为与设备兼容的值。

摩托罗拉并不是唯一出现此问题的设备,因为在我的工作中,我发现其他设备的联系人应用程序不能很好地处理添加到设备上的自定义帐户的记录。

在设置过程中,您必须确定运行的设备类型,然后确定将使用哪个帐户来存储联系人。我发现 Samsung Galaxy、HTC Sense 设备和 MOTOBLUR 设备存在例外情况,使用自定义联系人帐户不允许您在联系人应用程序中处理联系人(例如,您可以添加它们,但不能编辑或删除它们)无法将新记录插入您的帐户)。

我无法共享代码,因为它属于我的工作,但我可以告诉您,如果您在 MOTOBLUR 设备上使用以下帐户作为联系人,它将起作用。 Verizon 上的摩托罗拉设备有一个备份助理帐户,效果很好,否则我使用默认的 BLUR 帐户,它似乎效果很好。

在设备上查找类型为 com.motorola.android.buacontactadapter 的帐户
和“电话”名称并使用它。如果不存在,请查找 com.motorola.blur.service.bsutils.MOTHER_USER_CREDS_TYPE 类型的帐户并使用该帐户(无论其名称是什么),然后您就可以在 Motorola 设备上完成设置了。

如果您分享一些代码或您引用的示例的链接,我很乐意更深入地研究。

The Motorola BLUR modifications to contacts have more to do with how accounts are managed on the device and less with changes to the content provider. The real issue when working with a Motorola BLUR device is that you need to set the ACCOUNT_NAME and ACCOUNT_TYPE to a value that plays nice with the device.

Motorola isn't the only device for which this is an issue as in my work I have found other devices whose contacts applications don't play nice with records that are added to custom accounts on the device.

During setup, you'll have to determine what type of device you are running on and then make a determination of what account you will use to store your contacts. I have found exceptions for the Samsung Galaxy, HTC Sense devices and MOTOBLUR devices for which using a custom contact account doesn't allow you to work with your contacts in the contact application (for example, you can add them, but not edit or are unable to insert new records to your account).

I can't share code because it belongs to my work, but I can tell you that if you use the following account for your contacts on MOTOBLUR devices it will work. Motorola devices on Verizon have a backup assistant account that works great and other wise I use the default BLUR account which seems to work well.

Look for an account on the device with the type com.motorola.android.buacontactadapter
and a name of "Phone" and use that. If that's not present, look for an account of the type com.motorola.blur.service.bsutils.MOTHER_USER_CREDS_TYPE and use that (with whatever its name is) and you'll be all set on Motorola devices.

If you share some of your code or a link to the example you referenced, I'd be happy to dive deeper.

哀由 2024-10-07 01:01:50

为了解决你的问题的结尾:

这个基础设施只支持 2.x 联系人结构,那是他们引入它的时候。

1.X 设备上的 OEM 联系人应用程序可能会也可能不会以类似的方式工作。

To address the end of your question:

This infrastructure is only supported for 2.x contacts structure, that's when they introduced it.

OEM Contacts apps on 1.X devices may or may not work similarly.

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