0

I am using Smack library for XMPP, but getting bad-request error, when trying to invite user and giving him permission of Admin (When I created a room).

Code :

    try{
        muc.grantMembership(userId);
    } catch (XMPPException.XMPPErrorException e) {
        e.printStackTrace();
    } catch (SmackException.NoResponseException e) {
        e.printStackTrace();
    }
    muc.invite(userId, "Join a group chat");

Please help me to solve this issue. Thanks

NehaK
  • 2,639
  • 1
  • 15
  • 31
  • The issue was on server side.. when I was trying to get members of group.. then i was getting the error.. they didnt allow any user except owner to get members of group. – NehaK Dec 22 '16 at 19:10

1 Answers1

1

There are many failure points, check in your code what you miss:

  1. Owner and or Admins must be setted while sending Configuration Form to server
  2. To grant membership, multiuserchat must be persistant (check again Configuration Form)
  3. To grant membership and send invitation, user must be at least an Admin.
  4. userid must be valorized by a bareJID (example: user@server)
  5. Server must supports persistant groupchats
  6. To grant membership or invitation, user must already joined the room
MrPk
  • 2,862
  • 2
  • 20
  • 26