I am creating a facebook chat client using asmack library. Creating a connection, retrieval of contacts, establishing a chat, everything goes fine. However, when a user goes offline, it takes a while (about a minute or so) before my
presenceChanged
method in the RosterListener is executed. When a user goes online, presenceChanged method is executed almost immediately. Code I am using is just a simple RosterListener:
roster.addRosterListener(new RosterListener() {
// Ignored events
public void entriesAdded(Collection addresses) {}
public void entriesDeleted(Collection addresses) {}
public void entriesUpdated(Collection addresses) {}
public void presenceChanged(Presence presence) {
//do something to add/remove contact from list
}
});
Is this something Facebook related? Or Smack related? Is there any workaround for this?
I am using asmack in android using my own openfire server and the presence works fine. I think its kinda facebook related because even on facebook website sometime it happens that you see a person online and start a chat, it eventually changes the status to offline.
Try removing or adding a friend to see if you roster works, show a log in the method enteries updated. if the entries are instantly updated than it means that this is a facebook related issue.