Display synced contacts on HTC Sense

I am currently working on a SyncAdapter to add contacts from a WebService. Everything works fine on the emulator, but the contacts do not appear on my HTC Desire using HTC Sense.

I read that Sense needs “real” contacts to “link” a new one, but I'm sure the Facebook sync app is adding new contacts.

So does anyone know how to do this? Thank.

+3
source share
1 answer

Ok, it just works, you just need to declare your account in groups. Here is what I did:

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);
+3
source

Source: https://habr.com/ru/post/1794367/


All Articles