Alex Albalá
Alex Albalá

Reputation: 93

Android Contacts not showing my custom account_type

I have created a custom account_type (com.axonsystem.kangoosave) and is working fine. Also when I create contacts under this account_type programatically, in the Contacts Application (when I edit the contact) Android shows correctly my custom type.

This is my sync-adapter

<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.android.contacts"
android:accountType="com.axonsystem.kangoosave"
android:userVisible="true"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="true"
android:supportsUploading="false" />

And my service providing the SyncAdapter

<service
        android:name="com.axonsystem.kangoosave.services.AccountSyncService"
        android:exported="true"
        android:enabled="true"
        android:process=":sync">
        <intent-filter>
            <action android:name="android.content.SyncAdapter"/>
        </intent-filter>
        <meta-data android:name="android.content.SyncAdapter"
            android:resource="@xml/syncadapter"/>
        <meta-data android:name="android.provider.CONTACTS_STRUCTURE"
            android:resource="@xml/contacts" />
    </service>

My account-authenticator

<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.axonsystem.kangoosave"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:smallIcon="@drawable/ic_launcher"
android:accountPreferences="@xml/account_preferences"/>

Now I want that my custom-type appears in Contacts Activity when creating a new contact (like google accounts and so on), even in the menu of "Contacts to display". Is it poosible ? Do someone have some information about that? I'm not able to get success in this point..

Thank you in advance

Upvotes: 4

Views: 849

Answers (1)

Marten
Marten

Reputation: 3872

My first guess is that you'll have to change android:supportsUploading="false" in your sync-adapter xml to android:supportsUploading="true", otherwise the account may be considered being read-only (that's how it was handled in Android 2.x and I think that might be still the case).

Also it's important that your xml/contacts file defines a non-empty contacts schema, check out test_basic_contacts.xml for a complete example. An empty EditSchema basically means that no fields can be edited, which means the account is read-only as well (hence you can't create contacts).

Upvotes: 1

Related Questions