title: how to add contact group to my own account in Android 4.2
body: <p>I'm developing an Android account app. Now I can add my own account in Android.
  But when I open the Contacts app and switch to group pager, it shows me "<strong>No groups. To create groups you need an account.</strong>". So how to let android know my account can add a group?</p>
  
  <p>Below is my xml file:</p>
  
  <p>AndroidManifest.xml:</p>
  
  <pre><code>    &lt;!-- The sync service --&gt;
      &lt;service
              android:name="com.snail.android.sync.SyncService"
              android:exported="true"
              android:process=":sync"&gt;
  
          &lt;intent-filter&gt;
              &lt;action android:name="android.content.SyncAdapter"/&gt;
          &lt;/intent-filter&gt;
  
          &lt;meta-data
                  android:name="android.content.SyncAdapter"
                  android:resource="@xml/contacts_sync_adapter"/&gt;
          &lt;meta-data
                  android:name="android.provider.CONTACTS_STRUCTURE"
                  android:resource="@xml/contacts"/&gt;
  
      &lt;/service&gt;
  </code></pre>
  
  <p>contacts.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;ContactsAccountType&gt;
      &lt;EditSchema&gt;
          &lt;!--
              Name:
              - maxOccurs must be 1
              - No types.
  
              - Currently all the supportsXxx attributes must be true, but here's the plan for the
                future:
                (There's some hardcoded assumptions in the contact editor, which is one reason
                for the above restriction)
  
                  - "Family name" and "Given name" must be supported.
                      - All sync adapters must support structured name. "display name only" is not
                        supported.
                        -&gt; Supporting this would require relatively large changes to
                           the contact editor.
  
                  - Fields are decided from the attributes:
                      StructuredName.DISPLAY_NAME         if supportsDisplayName == true
                      StructuredName.PREFIX               if supportsPrefix == true
                      StructuredName.FAMILY_NAME          (always)
                      StructuredName.MIDDLE_NAME          if supportsPrefix == true
                      StructuredName.GIVEN_NAME           (always)
                      StructuredName.SUFFIX               if supportsSuffix == true
                      StructuredName.PHONETIC_FAMILY_NAME if supportsPhoneticFamilyName == true
                      StructuredName.PHONETIC_MIDDLE_NAME if supportsPhoneticMiddleName == true
                      StructuredName.PHONETIC_GIVEN_NAME  if supportsPhoneticGivenName == true
  
                  - DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME  is always added.
                  - DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME is added
                    if any of supportsPhoneticXxx == true
          --&gt;
          &lt;!-- Fallback/Google definition.  Supports all. --&gt;
          &lt;DataKind
                  kind="name"
                  maxOccurs="1"
                  supportsDisplayName="true"
                  supportsPrefix="true"
                  supportsMiddleName="true"
                  supportsSuffix="true"
                  supportsPhoneticFamilyName="true"
                  supportsPhoneticMiddleName="true"
                  supportsPhoneticGivenName="true"
                  &gt;
          &lt;/DataKind&gt;
  
          &lt;!-- Exchange definition.  No display-name, no phonetic-middle.
          &lt;DataKind kind="name"
              supportsDisplayName="false"
              supportsPrefix="true"
              supportsMiddleName="true"
              supportsSuffix="true"
              supportsPhoneticFamilyName="true"
              supportsPhoneticMiddleName="false"
              supportsPhoneticGivenName ="true"
              &gt;
          &lt;/DataKind&gt;
          --&gt;
  
          &lt;!--
              Photo:
              - maxOccurs must be 1
              - No types.
          --&gt;
          &lt;DataKind
                  kind="photo"
                  maxOccurs="1"/&gt;
  
          &lt;!--
              Phone definition.
              - "is secondary?" is inferred from type.
          --&gt;
          &lt;!-- Fallback, Google definition.  --&gt;
          &lt;DataKind kind="phone"&gt;
              &lt;!-- Note: Google type doesn't have obsolete ones --&gt;
              &lt;Type type="mobile"/&gt;
              &lt;Type type="home"/&gt;
              &lt;Type type="work"/&gt;
              &lt;Type type="fax_work"/&gt;
              &lt;Type type="fax_home"/&gt;
              &lt;Type type="pager"/&gt;
              &lt;Type type="other"/&gt;
              &lt;Type type="custom"/&gt;
              &lt;Type type="callback"/&gt;
              &lt;Type type="car"/&gt;
              &lt;Type type="company_main"/&gt;
              &lt;Type type="isdn"/&gt;
              &lt;Type type="main"/&gt;
              &lt;Type type="other_fax"/&gt;
              &lt;Type type="radio"/&gt;
              &lt;Type type="telex"/&gt;
              &lt;Type type="tty_tdd"/&gt;
              &lt;Type type="work_mobile"/&gt;
              &lt;Type type="work_pager"/&gt;
              &lt;Type type="assistant"/&gt;
              &lt;Type type="mms"/&gt;
          &lt;/DataKind&gt;
  
          &lt;!-- Exchange definition.
          &lt;DataKind kind="phone" &gt;
              &lt;Type type="home" maxOccurs="2" /&gt;
              &lt;Type type="mobile" maxOccurs="1" /&gt;
              &lt;Type type="work" maxOccurs="2" /&gt;
              &lt;Type type="fax_work" maxOccurs="1" /&gt;
              &lt;Type type="fax_home" maxOccurs="1" /&gt;
              &lt;Type type="pager" maxOccurs="1" /&gt;
              &lt;Type type="car" maxOccurs="1" /&gt;
              &lt;Type type="company_main" maxOccurs="1" /&gt;
              &lt;Type type="mms" maxOccurs="1" /&gt;
              &lt;Type type="radio" maxOccurs="1" /&gt;
              &lt;Type type="assistant" maxOccurs="1" /&gt;
          &lt;/DataKind&gt;
          --&gt;
  
          &lt;!--
              Email
          --&gt;
          &lt;!-- Fallback/Google definition.  --&gt;
          &lt;DataKind kind="email"&gt;
              &lt;!-- Note: Google type doesn't have obsolete ones --&gt;
              &lt;Type type="home"/&gt;
              &lt;Type type="work"/&gt;
              &lt;Type type="other"/&gt;
              &lt;Type type="mobile"/&gt;
              &lt;Type type="custom"/&gt;
          &lt;/DataKind&gt;
  
          &lt;!--
              Exchange definition.
              - Same definition as "fallback" except for maxOccurs=3
          &lt;DataKind kind="email" maxOccurs="3" &gt;
              &lt;Type type="home" /&gt;
              &lt;Type type="work" /&gt;
              &lt;Type type="other" /&gt;
              &lt;Type type="mobile" /&gt;
              &lt;Type type="custom" /&gt;
          &lt;/DataKind&gt;
          --&gt;
  
          &lt;!--
              Nickname
              - maxOccurs must be 1
              - No types.
          --&gt;
          &lt;DataKind
                  kind="nickname"
                  maxOccurs="1"/&gt;
  
          &lt;!--
              Im:
               - The TYPE column always stores Im.TYPE_OTHER (defaultValues is always set)
               - The user-selected type is stored in Im.PROTOCOL
          --&gt;
          &lt;!-- Fallback, Google definition.  --&gt;
          &lt;DataKind kind="im"&gt;
              &lt;Type type="aim"/&gt;
              &lt;Type type="msn"/&gt;
              &lt;Type type="yahoo"/&gt;
              &lt;Type type="skype"/&gt;
              &lt;Type type="qq"/&gt;
              &lt;Type type="google_talk"/&gt;
              &lt;Type type="icq"/&gt;
              &lt;Type type="jabber"/&gt;
              &lt;Type type="custom"/&gt;
          &lt;/DataKind&gt;
  
          &lt;!-- Exchange definition.
          &lt;DataKind kind="im" maxOccurs="3" &gt;
              &lt;Type type="aim" /&gt;
              &lt;Type type="msn" /&gt;
              &lt;Type type="yahoo" /&gt;
              &lt;Type type="skype" /&gt;
              &lt;Type type="qq" /&gt;
              &lt;Type type="google_talk" /&gt;
              &lt;Type type="icq" /&gt;
              &lt;Type type="jabber" /&gt;
              &lt;Type type="custom" /&gt;
          &lt;/DataKind&gt;
          --&gt;
  
          &lt;!--
              Postal address.
          --&gt;
          &lt;!-- Fallback/Google definition.  Not structured. --&gt;
          &lt;DataKind
                  kind="postal"
                  needsStructured="false"&gt;
              &lt;Type type="home"/&gt;
              &lt;Type type="work"/&gt;
              &lt;Type type="other"/&gt;
              &lt;Type type="custom"/&gt;
          &lt;/DataKind&gt;
  
          &lt;!-- Exchange definition.  Structured.
          &lt;DataKind kind="postal" needsStructured="true" &gt;
              &lt;Type type="work" /&gt;
              &lt;Type type="home" /&gt;
              &lt;Type type="other" /&gt;
          &lt;/DataKind&gt;
          --&gt;
  
          &lt;!--
              Organization:
              - Fields are fixed: COMPANY, TITLE
              - maxOccurs must be 1
              - No types.
          --&gt;
          &lt;DataKind
                  kind="organization"
                  maxOccurs="1"/&gt;
  
          &lt;!--
              Website:
              - No types.
          --&gt;
          &lt;DataKind kind="website"/&gt;
  
          &lt;!--
              Below kinds have nothing configurable.
              - No types are supported.
              - maxOccurs must be 1
          --&gt;
          &lt;DataKind
                  kind="sip_address"
                  maxOccurs="1"/&gt;
          &lt;DataKind
                  kind="note"
                  maxOccurs="1"/&gt;
  
          &lt;!--
              Google/Exchange supports it, but fallback doesn't.
          &lt;DataKind kind="group_membership" maxOccurs="1" /&gt;
          --&gt;
  
          &lt;!--
              Event
          --&gt;
          &lt;DataKind
                  kind="event"
                  dateWithTime="false"&gt;
              &lt;Type
                      type="birthday"
                      maxOccurs="1"
                      yearOptional="true"/&gt;
              &lt;Type type="anniversary"/&gt;
              &lt;Type type="other"/&gt;
              &lt;Type type="custom"/&gt;
          &lt;/DataKind&gt;
  
          &lt;!--
              Exchange definition.  dateWithTime is needed only for Exchange.
          &lt;DataKind kind="event" dateWithTime="true"&gt;
              &lt;Type type="birthday" maxOccurs="1" /&gt;
          &lt;/DataKind&gt;
          --&gt;
  
          &lt;!--
              Relationship
          --&gt;
          &lt;DataKind kind="relationship"&gt;
              &lt;Type type="assistant"/&gt;
              &lt;Type type="brother"/&gt;
              &lt;Type type="child"/&gt;
              &lt;Type type="domestic_partner"/&gt;
              &lt;Type type="father"/&gt;
              &lt;Type type="friend"/&gt;
              &lt;Type type="manager"/&gt;
              &lt;Type type="mother"/&gt;
              &lt;Type type="parent"/&gt;
              &lt;Type type="partner"/&gt;
              &lt;Type type="referred_by"/&gt;
              &lt;Type type="relative"/&gt;
              &lt;Type type="sister"/&gt;
              &lt;Type type="spouse"/&gt;
              &lt;Type type="custom"/&gt;
          &lt;/DataKind&gt;
      &lt;/EditSchema&gt;
  &lt;/ContactsAccountType&gt;
  </code></pre>