getContactAvatar

private fun getContactAvatar(context: Context, contactId: Long): ByteArray?(source)

Resolves the contact's photo into a ByteArray.

This method attempts to fetch the high-resolution photo from the ContactsContract.Contacts.Photo directory. If high-res is unavailable, it falls back to the system thumbnail.

Return

Byte array of the image data or null if no photo exists.

Parameters

context

Application context.

contactId

The unique contact identifier.