I have written my own Sync Adapter for android. I can make the contacts appear in the contacts app. But im unable to create new ones for this account type using the default Contact app in android.
It's very hard to find any information on how to get my own account type listed for creation in the default contacts app while creating a contact
only three kind of account in android.
1) Google Account,
2) Exchange Account,
3) Writable account, and by writable, it means that your contacts.xml file should contain EditSchema
tag.
And about EditSchema
, there is a good sample in the following 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
In android manifest file you should add this meta-data for contacts.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>
This code work for me.. try this.. sorry for late answer.
But I hope it help for someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With