Sending Image Attachment in Quickblox

1.4k views Asked by At

Iam new to quickblox. Iam trying to send image in chat using quickblox.I have a doubt that can we use getPublicUrl method to pass the URL to the receiver and then using imageloader to load it.If yes then what is use of QBAttachment??

1

There are 1 answers

0
Rubycon On BEST ANSWER

Yes you can,

just pass QBFile.id to QBAttachment:

// attach a photo
QBFile someFile = ...;
String fileId = "" + someFile.getId();
QBAttachment attachment = new QBAttachment("photo");
attachment.setId(fileId);
chatMessage.addAttachment(attachment);

And on the receiver side:

QBAttachment attachment = ...;
String fileId = attachment.getId();

QBFile file = new QBFile();
file.setId(Integer.valueOf(fileId));

String publicUrl = file.getPublicUrl();