Reputation: 91
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??
Upvotes: 2
Views: 1495
Reputation: 18346
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();
Upvotes: 2