Android AccountManager和SyncManager实现仅导致名称字段出现在添加/编辑联系人屏幕中

时间:2011-02-10 05:52:22

标签: android contacts accountmanager

我们实施了Android的帐户管理器和Sync Manager API来创建联系人同步。但是当用户在添加联系人时选择我们的帐户时,它只会显示名称字段,而所有其他字段都会消失。

以下是我在清单中的内容

<activity android:name=".AuthenticatorActivity" android:label="iAnywhere Login"
            android:theme="@android:style/Theme.Dialog"
            android:excludeFromRecents="true"></activity>
        <service android:name=".accounts.AuthenticationService">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator"></action>
            </intent-filter>
            <meta-data android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/authenticator">

            </meta-data>
        </service>

        <service
            android:name=".accounts.SyncService"
            android:exported="true">
            <intent-filter>
                <action
                    android:name="android.content.SyncAdapter" />
            </intent-filter>
            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/syncadapter" />
        </service>

这就是我在syncadapter.xml和authenticator.xml

中的内容     
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:contentAuthority="com.android.contacts"
    android:accountType="com.rahul.utility.contacts"
/>

在添加自定义字段时,已经看到人们谈论此类问题,这是联系人应用程序中的一个错误。我还检查了Android源代码中的Exchange电子邮件客户端代码,它们似乎与我所做的完全相同,但是当您为Exchange帐户选择“添加联系人”时,它仍会显示联系人中的所有字段。

1 个答案:

答案 0 :(得分:0)

经过大量研究并调查Android代码库后,我发现Android只会将帐户类型检查为Google或Default,以便呈现所有字段。如果帐户类型是任何其他类型,则它仅显示基本的两个字段。除了创建自己的联系人添加/编辑屏幕(悲伤!真的)之外,没有其他工作。

Android有可能为其他人提供了一个界面,让他们可以在屏幕上返回他们想要的字段类型但是现在还没有这样实现。

相关问题