I've created a custom account type and I can successfully create contacts of that type in the android ContactsContract ContentProvider. But I'm having a lot of trouble figuring out how to get my custom account label and icon to show up when editing the contact in the default contacts app.
When editing a custom contact type, the label should be something like " contact", with your app's icon to the right. Instead, editing contacts of my type always show a label of "Phone-only, unsynced contact". See the first screenshot below for an example.
The weird thing is that it does pick up my account name, which you can see in the screenshot underneath the incorrect label (it starts with "+1415").
And I have successfully shown my app's label and icon in the settings app under accounts, so I know I'm doing something right. See the second screenshot below for proof of that (the account label is "Bolt").
I have the following authenticator.xml:
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="@string/account_type"
android:label="@string/app_name"
android:icon="@drawable/app_icon"
android:smallIcon="@drawable/app_icon" />
And this is my syncadapter.xml:
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="@string/contacts_content_authority"
android:accountType="@string/account_type"
android:userVisible="true"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="true"
android:supportsUploading="false" />
Can anyone point me to where I'm going wrong with this? I can provide more info as necessary. I've tried creating the contact from within my SyncAdapter using the CLIENT_IS_SYNCADAPTER parameter but that didn't change anything. I've tried a few other things as well but nothing's worked yet.
I finally figured out what the issue was.
In my sync-adapter
element the android:contentAuthority
attribute was set to a custom content authority for my own contacts ContentProvider
, which is technically what I use to query and write contact data. But it turns out to get your contacts to show up in the default contacts app this attribute must be set to "com.android.contacts"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With