I am currently building an chat application for android.
XMPP Server: MongooseIM.
XMPP Client: Smack 4.1.5.
Currently the logged in user keeps getting presence updates from his roaster buddies. I would like to receive these presence updates only when the application is open and block them when the application is closed. Is there a way to achieve this behavior? I have tried using privacy list but with no luck.
This is what i have tried so far.
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(mXMPPConnection);
ArrayList privacyItems = new ArrayList();
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.subscription, "to", false, 1);
item.setFilterPresenceIn(true);
privacyItems.add(item);
privacyManager.createPrivacyList("subscription", privacyItems);