Hi,
I just noticed something that took me hours to figure out.
In Roster and Presence Docs you simply have something like
Roster roster = Roster.getInstanceFor(con);
roster.addRosterListener(new RosterListener() {
// Ignored events public void entriesAdded(Collection<String> addresses) {}
public void entriesDeleted(Collection<String> addresses) {}
public void entriesUpdated(Collection<String> addresses) {}
public void presenceChanged(Presence presence) {
System.out.println("Presence changed: " + presence.getFrom() + " " + presence);
}
});
Now this is enough to someone who is well versed in XMPP but not otherwise. presenceChanged
brings false impression that When the other side presence changes, you will automagically get notified. However, you must subscribe to get the notification.
So I belive that need to be clarified and perhaps give some codelike this one here for each roster entry you wan to be notified
Presence presence = new Presence(Presence.Type.subscribe);
presence.setTo(jid);
connection.sendPacket(presence);
I wasted a lot of time troubleshooting a problem that does not exist and I though I should help others!