insertPhoto

fun insertPhoto(provider: ContentProviderClient, addressBookAccount: Account, rawContactId: Long, data: ByteArray): Uri?

Inserts a raw contact photo and resets RawContacts.DIRTY to 0 then.

If the contact provider needs more than 7 seconds to insert the photo, this method will time out and log the failure as a warning. In this case, the RawContacts.DIRTY flag may be set asynchronously by the contacts provider as soon as it finishes the operation.

Return

URI of the raw contact display photo (Photo.PHOTO_URI); null if image can't be decoded

Parameters

provider

client to access contacts provider

addressBookAccount

account of the contact, used to create sync adapter URIs

rawContactId

ID of the raw contact (RawContacts._ID])

data

contact photo (binary data in a supported format like JPEG or PNG)