1

I have several raw contacts linked to one contact:

_id - 130
contact_id - 17434
account_type - com.google
aggregation_mode - 0
account_name - ...@gmail.com
display_name - ...
raw_contact_is_user_profile - 0

_id - 230
contact_id - 17434
account_type - com.whatsapp
aggregation_mode - 0
account_name - WhatsApp
display_name - ...
raw_contact_is_user_profile - 0


_id - 17217
contact_id - 17434
account_type - com.example
aggregation_mode - 0
account_name - Example
display_name - ...
raw_contact_is_user_profile - 0

They belong to different accounts, is there a solid way to get which one is the "main" raw contact? One possible solution is to check how many fields in DATA column each contact has, but looks more like a hack.

Any help would be appreciated. Thanks.

MightySeal
  • 2,293
  • 2
  • 17
  • 32

2 Answers2

0

Looks like there's no concept of a primary account, so as described here I can use either com.google or the ones without account for the case when the user doesn't sync their contacts.

MightySeal
  • 2,293
  • 2
  • 17
  • 32
0

As you've found out, there's no such concept of a main contact in RawContacts, however, you can't really rely of each contact either having a Google raw, or a phone-only raw.

You'll find there are users that have contacts comprised of exchange contacts, or Yahoo contacts, or others you haven't heard of, or contacts with any combination of those and others.

Whatever it is you're trying to do, there should be a way to do it without selecting a single raw out of the joined raws

marmor
  • 27,641
  • 11
  • 107
  • 150