Skip to content

Instantly share code, notes, and snippets.

@vestrel00
Last active October 10, 2021 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vestrel00/0f3c3444ba1953ad53d7ed4b5fe8dd5a to your computer and use it in GitHub Desktop.
Save vestrel00/0f3c3444ba1953ad53d7ed4b5fe8dd5a to your computer and use it in GitHub Desktop.
You have full access to all contacts and their data
Log.d(
"Contacts",
contacts.joinToString("\n\n") { contact ->
"""
ID: ${contact.id}
Display name: ${contact.displayNamePrimary}
Display name alt: ${contact.displayNameAlt}
Photo Uri: ${contact.photoUri}
Thumbnail Uri: ${contact.photoThumbnailUri}
Last updated: ${contact.lastUpdatedTimestamp}
Starred?: ${contact.options?.starred}
Send to voicemail?: ${contact.options?.sendToVoicemail}
Ringtone: ${contact.options?.customRingtone}
Aggregate data from all RawContacts
-----------------------------------
Addresses: ${contact.addressList()}
Emails: ${contact.emailList()}
Events: ${contact.eventList()}
Group memberships: ${contact.groupMembershipList()}
IMs: ${contact.imList()}
Names: ${contact.nameList()}
Nicknames: ${contact.nicknameList()}
Notes: ${contact.noteList()}
Organizations: ${contact.organizationList()}
Phones: ${contact.phoneList()}
Relations: ${contact.relationList()}
SipAddresses: ${contact.sipAddressList()}
Websites: ${contact.websiteList()}
-----------------------------------
""".trimIndent()
}
)
// There are also aggregate data functions that return a sequence instead of a list.
// Each Contact may have more than one of the following data if the Contact is made up of 2 or more RawContacts;
// name, nickname, note, organization, sip address.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment