I'm struggling to listen to contacts' updating of VCard. I'm trying to do this by sending a custom presence that carries some custom information while updating VCard.from the output of the debug,I found that ,whenever such a custom presence is send,it's contact will receive the presence stanza.Unfortunately,when the contact's packetListener can not detect the incoming packet,and then all of the listener added to the connection seems have been removed, that is other packet that can be detected previously can not listened though the debug still works well. some of my code snippet just like this:
// to update VCard
mVCard.load(mXMPPConnection);
mVCard.setField(XmppUserInfo.tagHeadIcon, userInfo.getHeadIconUrl());
mVCard.setField(XmppUserInfo.tagGender, userInfo.getGender());
mVCard.setField(XmppUserInfo.tagNickname,userInfo.getNickname());
mVCard.setField(XmppUserInfo.tagAccount, userInfo.getAccount());
mVCard.setField(XmppUserInfo.tagSignnature, userInfo.getSignnature());
mVCard.save(mXMPPConnection);
// to send custom presence to subscribers to renew infomation
Presence presence = new Presence(Type.available);
presence.addExtension(new UserInfoExtension(userInfo));
mXMPPConnection.sendPacket(presence);
and my Listener is like this :
//add Listener
PacketListener packetListener = new PacketListener() {
@Override
public void processPacket(Packet packet) {
if(null != packet){
Log.i(TAG,"UserInfo is being updated" );
Log.i(TAG, "the packet is " +packet.toXML());
}
}
}
};
xmppConnection.addPacketListener(packetListener, new PacketFilter() {
@Override
public boolean accept(Packet p) {
return true;
}
});
but I can not say the prescen stanza in log though I can receive the presence from the output of debug. can any body help me? thanks very much.
the receieved presence is like this:
<presence id="AL4As-4" from="20298509@openfire/ad9a8862" to="20298468@openfire">
<user xmlns="kascend:video:xmpp:userinfo">
<info account="133787245" gender="f" signnature="wwwwwww" nickname="bbbb"/>
</user>
<c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack/" ver="O1jiM4C3yPnCFLp9hBZUn4AgVXs="/></presence>