2012-06-15 52 views
3

我使用asmack與谷歌談話(Android)連接。
我可以得到姓名,電子郵件。
我看了this link。它使用"http://profiles.google.com/s2/photos/profile/" + userid + "?sz=" + size;谷歌談話圖像配置文件。獲取個人資料圖片谷歌與asmack在android中的交談

我如何得到asmack的用戶ID?
或者我可以通過任何其他方式獲取Google Talk的個人資料圖片嗎?

回答

4

您可以使用VCard加載使用asmack任何用戶的詳細信息,

得到谷歌個人資料圖片說話嗎?

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 

我如何asmack獲得用戶ID?

你必須通過名冊條目進行迭代得到user_mail_id,

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

for (RosterEntry entry : rosterEntries) { 
    String user_mail_id = entry.getUser(); 
} 
相關問題