Hi All,
how can I get the contact picture information using smack 3.0.4? As part of presence information I can see a photo tag in the Smack Debug window. But I am not sure how to use it.
Thanks,
NS
Hi All,
how can I get the contact picture information using smack 3.0.4? As part of presence information I can see a photo tag in the Smack Debug window. But I am not sure how to use it.
Thanks,
NS
I tried
VCard vCard = new VCard();
vCard.load(connection, "xyz@gmail.com");
byte[] avatarBytes = vCard.getAvatar();
avatarBytes are null
I got message:
Vcard: doLoad:540: No VCard for xyz@gmail.com
Can someone help, does vCard.getAvatar() works?
private VCard getVCard() {
try {
if (myJID == null)
vCard.load(con.getConnection());
else vCard.load(con.getConnection(), myJID);
// If VCard is loaded, then save the avatar to the personal folder.
byte[] bytes = vCard.getAvatar();
if (bytes != null) {
avatar = new ImageIcon(bytes); // just save in memory?
icon = scale(avatar);
/*if (avatar != null && avatar.getIconWidth() != -1) {
BufferedImage image = GraphicUtils.convert(icon.getImage());
ImageIO.write(image, "PNG", imageFile);
}*/
}
} catch (XMPPException ex) {
ex.printStackTrace();
}
return vCard;
}
The contact may not have filled their VCard out or set an avatar, so then you get null.