3

I'm currently working on a SyncAdapter to add contacts from a WebService. Everything is working fine on the emulator but Contacts doesn't show up on my HTC Desire running HTC Sense.

I've read that Sense needs "real" contacts to "link" the new one but I'm pretty sure Facebook sync application adds new contacts.

So does anyone know how it can be done? Thanks.

1 Answers1

3

Ok, just got it working, you just have to declare your account in the groups. Here is what I've done :

ContentProviderClient client = mContext.getContentResolver().acquireContentProviderClient(ContactsContract.AUTHORITY_URI);
ContentValues cv = new ContentValues();
cv.put(Groups.ACCOUNT_NAME, account.name);
cv.put(Groups.ACCOUNT_TYPE, account.type);
cv.put(Settings.UNGROUPED_VISIBLE, true);
client.insert(Settings.CONTENT_URI.buildUpon()
    .appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true")
    .build(), cv);
  • Man, I'm so glad I stumbled on this! Thank you. This actually applies to my latest question here http://goo.gl/HGyRA, so if you post your answer as a link to this answer there I would gladly accept it – Bostone May 02 '11 at 20:01