In my application when I have to add a friend I usually do send subscription packets 4 times i.e
A->B (subscribe) B->A ( subscribed) B-A( subscribe) A->B ( subscribe
For sending a request you have to use,
roster.createEntry("mail_id", null, null);
And for Listening
the Request you have to listen using PacketListener
. And check the Presence
Presence presence = (Presence) packet;
Presence presence_request = new Presence(Presence.Type.subscribed);
presence_request.setTo(presence.getFrom());
presence_request.setType(Presence.Type.subscribed);
presence_request.setFrom("current_logged_in_user");
connection.sendPacket(presence_request);
roster.createEntry(presence.getFrom(), null, null);