netflix spotify
netflix spotify

Reputation: 73

Sendbird group channel

Currently i have 2 users:

Tester1 and AnotherTester

I've been trying to create a public group channel using my Tester1 but whenever i try to create one.

It's not showing in my list using AnotherTester

Here is my code in creating public group channel

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);
                }
            }
        });

So Tester1 is the one that created a public group channel but when i switch to AnotherTester, it doesn't show the public group channel.

Here is my code in retrieving AnotherTester channels

  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);
                }
            }
        });

i hope you can help me.

Upvotes: 0

Views: 485

Answers (1)

Mayur Coceptioni
Mayur Coceptioni

Reputation: 443

You need to do atleast one message in that , then it will show to another user. Please try once to send one message.

Please try this code :-

   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;
            }
          }
       });
    }

Upvotes: 0

Related Questions