使用同步适配器创建的自定义帐户类型创建联系人

Mou*_*ice 5 android android-syncadapter

我已经为android编写了自己的Sync Adapter.我可以将联系人显示在联系人应用中.但我无法使用android中的默认联系人应用程序为此帐户类型创建新的.

在创建联系人时,很难找到有关如何在默认联系人应用程序中列出要创建的自己的帐户类型的任何信息

sta*_*try 3

Android 中只有三种帐户。

1)谷歌帐户,

2)兑换账户,

3)可写帐户,可写意味着您的contacts.xml文件应该包含EditSchema标签。

关于EditSchema,以下 URL 中有一个很好的示例:

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.0.3_r1/packages/apps/Contacts/tests/res/xml/test_basic_contacts.xml

在 Android 清单文件中,您应该为 contact.xml 添加此元数据。

 </service>
 <service android:name="com.example.ContactsSyncAdapterService"      
android:enabled="true" android:exported="true" android:process=":contacts">
 <intent-filter>
<action android:name="android.content.SyncAdapter" /> 
</intent-filter>
<meta-data android:name="android.content.SyncAdapter"   
 android:resource="@xml/sync_contacts" />

// this meta-data for contact.xml  
<meta-data android:name="android.provider.CONTACTS_STRUCTURE"    
 android:resource="@xml/contacts" />
 </service>
Run Code Online (Sandbox Code Playgroud)

这段代码对我有用..试试这个..抱歉回答晚了。

但我希望它对某人有帮助。