matiash
matiash

Reputation: 55380

Special "My Contacts" group in Android contacts

In Android, when the People app displays the contacts for a Google account, by default it shows only the contacts that belong to the My Contacts and Starred in Android groups.

I would like to display this same subset of contacts, since the full contact list includes a lot of fluff. This can be donde by testing group membership for each contact; this obviously requires kowing the desired group ids.

The question is: how can these "apparently special" groups be identified? Are their ids or names fixed? (They are 1 and 2 for the "primary" Gmail account in the devices I've tested, but I doubt this is reliable).

Upvotes: 1

Views: 212

Answers (1)

matiash
matiash

Reputation: 55380

According to the source code for the Contacts app (and in particular at the ContactLoader class in the ContactsCommon project), these groups can be identified by information in the Groups table. In particular:

  • AUTO_ADD == 1 for the Default (My Contacts) group.
  • FAVORITES == 1 for the Favorites (Starred in Android) group.

However, both these fields are available only on API level 11+.

Upvotes: 1

Related Questions