Roster Subsciption problem


i’m using the lastest smack 3.0.4 library. The problem i am experiencing is the following. Every time I connect, the roster subscription seems to be set on accept_all. although i set it to manual, it’s already too late !

Can someone shed some light ?

Thanks in advance


i think i’ve solved the mystery mylself. well you need to set the subscription mode between you login call and sending your presence back to the server.

pls confirm … thank you !

enjoy ! :stuck_out_tongue:

I set the SubscriptionMode after login and initial presence, but before registering the RosterListener.


You also can change the “Default” subscription mode, that is the mode for a new Roster when is created.


Thank you both !

one question though, since i’m setting the default subscription mode, where do I need to call it, since i suppose it just needs to be called once ?

thanks again


The “static” things in Java are unique for each running Virtual Machine (more specifically, each class loader). So, you need to call it only once, somewhere, when your application start, before creating rosters.

I do all this on application startup. Here’s a pseudo-code

create XMPP connection with configuration


set packetfilter

set packetlistener


if logged in

create roster object

get roster from connection

set subscription mode

set roster listener

get rostergroups

set chat manager

Thank you very much for the psuedo-code! very much appreciated ! i wish a good day to all !