Android SDK Samples - Organization Operations
ZCRMSDKUtil.getCompanyInfo(object : DataCallback<APIResponse, ZCRMCompanyInfo>
{
override fun completed(response: APIResponse, companyInfo: ZCRMCompanyInfo)
{
println("${response.responseJSON}")
}
override fun failed(exception: ZCRMException)
{
println("get companyInfo failed: $exception")
}
})
//$companyInfo object is of ZCRMCompanyInfo
//call uploadPhoto() using $companyInfo object by passing the fileRequestRefId, filePath and photoViewPermission as parameters
//fileRequestRefId - reference id which is used as a tag to this api request
//filePath - Path of the photo to be uploaded
//photoViewPermission - PhotoViewPermission (NONE, ZOHO_USERS, ORG_USERS, PUBLIC, CONTACTS)
$companyInfo.uploadPhoto("123456789", File(filename).absolutePath, CommonUtil.PhotoViewPermission.ORG_USERS,object : FileTransferTask<APIResponse>{
override fun onCompletion(response: APIResponse) {
println("${response.responseJSON}")
}
override fun onFailure(exception: ZCRMException) {
println("Throws Exception : $exception")
}
override fun onProgressUpdate(bytesWritten: Long, contentLength: Long, percentage: Double) {
println("OnProgress Update : ${bytesWritten}+${contentLength}+${percentage}")
}
})
File file = new File(Filename);
Uri uriSource = FileProvider.getUriForFile(applicationcontext, "com.example.android.fileprovider", file);
//$companyInfo object is of ZCRMCompanyInfo
//call uploadPhoto() using $companyInfo object by passing the fileRequestRefId, uri and photoViewPermission as parameters
//fileRequestRefId - reference id which is used as a tag to this api request
//uri - Uri of the resource to be uploaded
//photoViewPermission - PhotoViewPermission (NONE, ZOHO_USERS, ORG_USERS, PUBLIC, CONTACTS)
$companyInfo.uploadPhoto("file_req_ref_id", uriSource,CommonUtil.PhotoViewPermission.ORG_USERS, object : FileTransferTask<APIResponse> {
override fun onCompletion(response: APIResponse) {
println("${response.responseJSON}")
}
override fun onFailure(exception: ZCRMException) {
println("Throws Exception : $exception")
}
override fun onProgressUpdate(bytesWritten: Long, contentLength: Long, percentage: Double) {
println("OnProgress Update : ${bytesWritten}+${contentLength}+${percentage}")
}
})