Android联系人未显示我的自定义account_type

我创建了一个自定义account_type(com.axonsystem.kangoosave)并且工作正常.此外,当我以编程方式在此account_type下创建联系人时,在联系人应用程序中(当我编辑联系人时) Android正确显示我的自定义类型.

这是我的同步适配器

<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.android.contacts"
android:accountType="com.axonsystem.kangoosave"
android:userVisible="true"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="true"
android:supportsUploading="false" />

我的服务提供SyncAdapter

<service
        android:name="com.axonsystem.kangoosave.services.AccountSyncService"
        android:exported="true"
        android:enabled="true"
        android:process=":sync">
        <intent-filter>
            <action android:name="android.content.SyncAdapter"/>
        </intent-filter>
        <meta-data android:name="android.content.SyncAdapter"
            android:resource="@xml/syncadapter"/>
        <meta-data android:name="android.provider.CONTACTS_STRUCTURE"
            android:resource="@xml/contacts" />
    </service>

我的帐户验证员

<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.axonsystem.kangoosave"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:smallIcon="@drawable/ic_launcher"
android:accountPreferences="@xml/account_preferences"/>

现在我希望我的自定义类型在创建新联系人(如Google帐户等)时显示在“联系人活动”中,即使在“要显示的联系人”菜单中也是如此.它是poosible?有人有关于此的一些信息吗?在这一点上我无法取得成功..

先感谢您

最佳答案 我的第一个猜测是你必须在你的sync-adapter xml中更改android:supportsUploading =“false”到android:supportsUploading =“true”,否则该帐户可能被认为是只读的(这就是它的处理方式) Android 2.x,我认为可能仍然如此).

此外,您的xml / contacts文件定义非空联系人架构也很重要,请查看test_basic_contacts.xml以获取完整示例.空的EditSchema基本上意味着不能编辑任何字段,这意味着该帐户也是只读的(因此您无法创建联系人).

点赞