I use the aSmack library to implement the connection to the XMPP server. Connection and chat are working fine. But when I implement user lock using PrivacyManagerList, it returns NULL.
public void blockUser(String listName, String user) {
listName = "newList";
String groupName = "enemies";
ArrayList privacyItems = new ArrayList();
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.toString(),
true, 1);
item.setValue(user);
privacyItems.add(item);
PrivacyListManager privacyManager = PrivacyListManager
.getInstanceFor(connection);
try {
privacyManager.createPrivacyList(listName, privacyItems);
} catch (XMPPException e) {
e.printStackTrace();
}
}
This code is from the documentation, but it does not work. PrivacyListManager is always null. Please, I need help to solve this problem. Thanks!
source
share