Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get profile image from google talk with asmack in android

I use asmack to connect with google talk (Android).
I can get name, email.
I looked this link. It uses "http://profiles.google.com/s2/photos/profile/" + userid + "?sz=" + size; for google talk image profile.

How do i get userid in asmack?
Or any other ways can i do to get profile image of google talk?

like image 755
Chandara Sam Avatar asked Dec 28 '25 23:12

Chandara Sam


1 Answers

You can use VCard to load the details of any user using asmack,

Get Profile Image from google talk?

VCard vCard = new VCard();
SmackConfiguration.setPacketReplyTimeout(300000);
ProviderManager.getInstance().addIQProvider("vCard", "vcard-temp",
                    new VCardProvider());
vCard.load(connection, user_mail_id);
Log.d("Vcard XML", vCard.toXML()); // complete VCard information
byte[] bs = vCard.getAvatar();   // Avtar in byte array convert it to Bitmap

How do i get userid in asmack?

You have to iterate through the Roster Entries to get user_mail_id,

Roster roster = connection.getRoster();
Collection<RosterEntry> rosterEntries = roster.getEntries();

for (RosterEntry entry : rosterEntries) {
   String user_mail_id = entry.getUser();
}
like image 83
Lalit Poptani Avatar answered Jan 02 '26 14:01

Lalit Poptani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!