在gtalk for Android中进行群聊

时间:2011-11-23 12:58:25

标签: android google-talk

我使用smack 3.2.1 API制作gtalk Im。 我坚持使用群聊实施。 这是我发起群聊的代码:

conf = new MultiUserChat(connection, "room@groupchat.google.com");  // create object of multiserchat class

         try 
         {  // Create the room
            conf.create("room@groupchat.google.com");

            // Send an empty room configuration form which indicates that we want an instant room
            conf.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
         } 

         catch (XMPPException e) 
         {
            Toast.makeText(this, "Error in create room: "+e.toString(), Toast.LENGTH_LONG).show();
         }

conf.invite("userid", "Invitation for group chat");

但我收到错误:服务不可用(503)

提前致谢。

1 个答案:

答案 0 :(得分:2)

房间应该是 - 私聊 -

并且没有必要创造空间。

只需使用用户名和密码加入房间即可。这将是satishfy:

代码段:

String room = "private-chat-" + UUID.randomUUID().toString();
room = room + "@groupchat.google.com";
MultiUserChat muc = new MultiUserChat(cc, room);
    muc.join("username", "password");
    muc.invite("username", "hi");

让我知道这是否有效。

相关问题