i'm importing external contacts newly created account using this tutorial. account setup re-sync programmatically , yet, able see synced contact, - unless contact dupe found - need contacts->menu->display options->find account->check "all contacts"
. i'm dreading angry users enabling contact sync , not being able see question is: possible set display option including imported account contacts programmatically? when user opt account creation doesn't need else see imported contacts?
i had same problem , solved following code via account creation:
maccountmanager.addaccountexplicitly(account, mpassword, null); // set contacts sync account. contentresolver.setsyncautomatically(account, contactscontract.authority, true); contentproviderclient client = 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); try { client.insert(settings.content_uri.buildupon() .appendqueryparameter(contactscontract.caller_is_syncadapter, "true") .build(), cv); } catch (remoteexception e) {...}
Comments
Post a Comment