【问题标题】:Sendbird group channelSendbird 群频道
【发布时间】:2019-07-26 18:33:08
【问题描述】:

目前我有 2 个用户:

Tester1 和AnotherTester

我一直在尝试使用我的 Tester1 创建一个公共群组频道 但每当我尝试创建一个。

它没有显示在我使用 AnotherTester 的列表中

这是我创建公共群组频道的代码

GroupChannelParams params = new GroupChannelParams()
                .setPublic(true)
                .setDiscoverable(true)
                .setEphemeral(false)
                //    .addUserIds(users)
                .setDistinct(false)
                .setName(channelName);
        GroupChannel.createChannel(params, new GroupChannel.GroupChannelCreateHandler() {
            @Override
            public void onResult(GroupChannel groupChannel, SendBirdException e) {
                if (e != null) {    // Error.
                    Toast.makeText(context, "" + e.getMessage(), Toast.LENGTH_SHORT).show();
                    Logs.logError(e.getMessage());
                    retrySendConnection(context, String.valueOf(e.getCode()), e.getMessage());
                    return;
                } else {
                    //   inviteUser(groupChannel);
                    Logs.logData(groupChannel.getUrl());
                    Intent i = new Intent(MainActivity.this, channelChatActivity.class);
                    i.putExtra("channelUrl", groupChannel.getUrl());
                    startActivity(i);
                }
            }
        });

所以 Tester1 是创建公共群组频道的人 但是当我切换到AnotherTester时,它不会显示公共组频道。

这是我检索 AnotherTester 频道的代码

  GroupChannelListQuery channelListQuery1 = GroupChannel.createMyGroupChannelListQuery();
        channelListQuery1.setIncludeEmpty(true);
        channelListQuery1.next(new GroupChannelListQuery.GroupChannelListQueryResultHandler() {
            @Override
            public void onResult(List<GroupChannel> list, SendBirdException e) {
                if (e != null) {
                    Logs.logError(e.getMessage());// Error.
                    return;
                } else {
                    groupChannelList.addAll(list);
                    groupChannelAdapter = new groupChannelAdapter(context, groupChannelList);
                    initializeRecyclerView(channelAdapter);
                }
            }
        });

我希望你能帮助我。

【问题讨论】:

    标签: android sendbird


    【解决方案1】:

    您需要在其中至少发送一条消息,然后它将显示给另一位用户。请尝试发送一条消息。

    请试试这个代码:-

       private void createGroupChannel(List<String> userIds, boolean distinct, final String toID) {
           GroupChannel.createChannelWithUserIds(userIds, distinct, "tsg-chat-" + SessionUtils.getCurrentMemberId(this) + "-" + toID, "", "", new GroupChannel.GroupChannelCreateHandler() {
              @Override
                public void onResult(GroupChannel groupChannel, SendBirdException e) {
                if (e != null) {
                    // Error!
                    return;
                }
              }
           });
        }
    

    【讨论】:

    • 然后是我的 channelListQuery1.setIncludeEmpty(true);
    • 但尝试一次发送一条消息并检查
    • 你想要1对1聊天作为群聊还是多人一起唱
    • 仅限一对一聊天
    • 但是如果您阅读 sendbird ,事实是他们没有提供一对一的聊天。您需要做的是创建一个由两个成员组成的组,这将是一对一的聊天。您可以查看以下链接 - help.sendbird.com/hc/en-us/articles/…
    猜你喜欢
    • 1970-01-01
    • 2019-08-03
    • 2021-04-23
    • 1970-01-01
    • 1970-01-01
    • 2019-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多