0
public boolean connect() {
String host = "talk.google.com";
String port = "5222";
String service = "gmail.com";
ConnectionConfiguration connConfig = new ConnectionConfiguration(host,
Integer.parseInt(port), service);
connection = new XMPPConnection(connConfig);
try {
connection.connect();
log("xmpp connected");
connection.login("[email protected]", "Password");
log("user loged in");
log("loged user : " + connection.getUser());
} catch (XMPPException e) {
e.printStackTrace();
return false;
}
return true;
}
public void displayBuddyList() {
String user;
String status_Message;
int state;
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
log("Buddy list size :"+entries.size());
for (RosterEntry r : entries) {
user=r.getUser();
status_Message=retrieveStatusMessage(user);
log("name: "+r.getName()+" user :"+user+" Status :"+status_Message+" type :"+retrieveState(user));
}
}
這是我寫的service.Im控股XMPP連接對象在我的服務class.From活動IM調用這些methods.I可以登錄,我可以看到在logcat.But我」的日誌代碼當我調用displayBuddyList()時無法獲得好友列表。無法getBuddylist XMPP
WATS錯在我的代碼..?我得到的錯誤「主」是未知的代碼。 – Meher 2012-07-26 11:42:37
我正在使用asmack-2010.05.07-source – Meher 2012-07-26 11:43:28