Question

I'm trying to write my own Sync Adapter for android. I'm digging through the Sample Sync Adapter from SDK but it's horribly undocumented. I can make the contacts appear in the contacts app. But im unable to edit them or create new ones.

It's very hard to find any information on how to get my own account type listed for creation in the default contacts app or make them editable. I don't want to add any custom stüff only fields and data already supported by android.

Can any one point me to a tutorial or samples on how to integrate my sync adapter into the default contacts app (Like the exchange sync)?

  • What neets to be added to AndroidManifest.xml
  • What needs to be added to contacts.xml
  • What needs to be added to syncadapter.xml
  • Is there any code that needs to be added in order to work?

By the way:
I dont care for android versions lower than ICS. I read everywhere that the contacts app of 2.x does not support this but 3.x and above do. 2.x is off the table so I'm looking for the ICS way to do it.

Thanks in Advance

Was it helpful?

Solution

I think it's a little late to answer this question, but I had this problem and finally solved it. In android 4.x, you can add contact to 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. Also you should add the following tag to your manifest file:

<meta-data android:name="android.provider.CONTACTS_STRUCTURE" android:resource="@xml/contacts" />

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

You just need to copy above xml file's content and paste it in your contacts.xml file.(You can customize the xml, if you want) And everything is done!

OTHER TIPS

Have a look to this:

Edit custom contact in honeycomb

I asked this question before and I opened a bounty to get an answer. The answer was that although the feature is present in Honeycomb it is not documented anywhere. You needed to go through the code to learn how to do it.

I've now found that there is a bit of documentation like for example here:Blog about social network API

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top