如何让我的自定义帐户类型出现在Android的联系人应用程序? [英] How do I get my custom account type to show up in the android contacts app?

查看:436
本文介绍了如何让我的自定义帐户类型出现在Android的联系人应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个自定义帐户类型,我可以成功地创建该类型在Android ContactsContract的ContentProvider的联系。但我有很多的麻烦搞清楚如何得到我的自定义帐户标签和图标编辑默认的联系人应用程序中的联系人时展现出来。

I've created a custom account type and I can successfully create contacts of that type in the android ContactsContract ContentProvider. But I'm having a lot of trouble figuring out how to get my custom account label and icon to show up when editing the contact in the default contacts app.

当编辑自定义联系人类型,标签应该是这样的接触,用你的应用程序的图标右侧。相反,我喜欢的类型的编辑联系人始终显示仅限电话,不同步接触的标签。请参阅下面的第一张截图中的例子。

When editing a custom contact type, the label should be something like " contact", with your app's icon to the right. Instead, editing contacts of my type always show a label of "Phone-only, unsynced contact". See the first screenshot below for an example.

奇怪的是,它并拿起我的帐户名,您可以在不正确的标签下面的截图中看到(它以1415)。

The weird thing is that it does pick up my account name, which you can see in the screenshot underneath the incorrect label (it starts with "+1415").

和我已经成功地表明我的应用程序的标签和图标在帐户下的设置应用程序,所以我知道我在做正确的事情。请参阅下面的第二个屏幕的证明了这一点(该帐户标签是闪电狗)。

And I have successfully shown my app's label and icon in the settings app under accounts, so I know I'm doing something right. See the second screenshot below for proof of that (the account label is "Bolt").

ALT =设置应用程序

我有以下authenticator.xml:

I have the following authenticator.xml:

<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="@string/account_type"
    android:label="@string/app_name"
    android:icon="@drawable/app_icon"
    android:smallIcon="@drawable/app_icon" />

这是我syncadapter.xml:

And this is my syncadapter.xml:

<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:contentAuthority="@string/contacts_content_authority"
    android:accountType="@string/account_type"
    android:userVisible="true"
    android:allowParallelSyncs="false"
    android:isAlwaysSyncable="true"
    android:supportsUploading="false" />

任何人都可以点我到我要去哪里错了呢?我可以提供必要的详细信息。我试着从创建使用CLIENT_IS_SYNCADAPTER参数我SyncAdapter内的接触,但并没有改变任何东西。我已经尝试了一些其他的东西很好,但什么也没有工作呢。

Can anyone point me to where I'm going wrong with this? I can provide more info as necessary. I've tried creating the contact from within my SyncAdapter using the CLIENT_IS_SYNCADAPTER parameter but that didn't change anything. I've tried a few other things as well but nothing's worked yet.

推荐答案

我终于想通了什么问题了。

I finally figured out what the issue was.

在我的同步适配器元素中的安卓contentAuthority 属性设置为自定义内容授权为我自己联系人的ContentProvider ,这在技术上是我用来查询和写入联系人数据。但事实证明,让你的联系人显示在默认通讯录应用此属性必须设置为com.android.contacts

In my sync-adapter element the android:contentAuthority attribute was set to a custom content authority for my own contacts ContentProvider, which is technically what I use to query and write contact data. But it turns out to get your contacts to show up in the default contacts app this attribute must be set to "com.android.contacts".

这篇关于如何让我的自定义帐户类型出现在Android的联系人应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆