I want to block a particular friend from my chat list with XMPP
. code works fine. There is no Exception, but I am not able to block a user.
I\'m using open fire ser
try this ...
public boolean blockFriend(String friendName) {
PrivacyItem item=new PrivacyItem(PrivacyItem.Type.jid,friendName, false, 7);
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(connection);
List list=new ArrayList();
list.add(item);
try {
privacyManager.updatePrivacyList(NEWLIST, list);
privacyManager.setActiveListName(NEWLIST);
return true;
} catch (SmackException.NoResponseException |XMPPException.XMPPErrorException | SmackException.NotConnectedException e) {
e.printStackTrace();
return false;
}
}
and for unblock just replace false with true in object of privacyitem `