The account does not appear in the application’s contact settings on the device from HTC

I am writing my own SyncAdapter based on an example in the SDK. It should add contacts from an external source, and it works great in a device emulator. But when I launch it on HTC Desire, I can not see my account in contacts-> Display options

I also tried the Google example on Desire and could not see them on this list. Does anyone know a solution?

+7
android contacts htc-android
source share
2 answers

I solve it by making my account visible by default.

ContentProviderClient client = getContentResolver().acquireContentProviderClient(ContactsContract.AUTHORITY_URI); ContentValues values = new ContentValues(); values.put(ContactsContract.Settings.ACCOUNT_NAME, account.name); values.put(ContactsContract.Settings.ACCOUNT_TYPE, account.type); values.put(ContactsContract.Settings.UNGROUPED_VISIBLE, true); try { client.insert(Settings.CONTENT_URI.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build(), values); } catch (RemoteException e) { e.printStackTrace(); } 

after this account is visible by default, and you can see it in the list of accounts in contacts

+6
source share

In order for your account to be visible in the "Display Settings" of the standard Contacts application, you must have a SyncAdapter in your application, and this is the metadata specified in syncadapter.xml as described here .

In addition, you must specify the use of android.permission.WRITE_SYNC_SETTINGS permission in AndroidManifest.xml .

UNGROUPED_VISIBLE makes it visible only to the list of contact groups.

0
source share

All Articles