powered by Jive Software

getRoster -> PacketListener doesn't work

hi All.i use aSmack.

Roster roster = tcpConnection.getRoster(); tcpConnection.addPacketListener(new PacketListener() {                                           tcpConnection.addPacketListener(new PacketListener() {
@Override
     public void processPacket(Packet packet) {
          System.out.println("processPacket->" + packet.toXML());
     }
}, new PacketFilter() {
     @Override
     public boolean accept(Packet packet) {
          System.out.println("accept->" + packet.toXML());
          return false;
}
});

but packet listener doesn’t work before&after getRoster.it’s blocked packet listener.

please help me

What are you trying to do? Accept friend request? If that is the case, then use

roster.addRosterListener(new RosterListener()

{

@Override

public void entriesAdded(Collection addresses)

{

}

@Override

public void entriesDeleted(Collection addresses)

{

// TODO Auto-generated method stub

}

@Override

public void entriesUpdated(Collection addresses)

{

// TODO Auto-generated method stub

}

@Override

public void presenceChanged(Presence presence)

{

// TODO Auto-generated method stub

}

});