Creating Sendbird Group channel with custom type not visible in other user of the group

581 views Asked by At

I'm trying to create two group channels with same name but with different users and custom type.` But both the group is not created and when I list the groups. I couldn't find what I have done wrong.

 createGroupChannelWithData(workOrderIds, false, "Ticket Id:" + jobId, "", Integer.toString(jobId), "Private_Ticket");

  private void createGroupChannelWithData(List<String> userIds, boolean distinct, String name, String coverImage, String data, String ticketType) {
        GroupChannel.createChannelWithUserIds(userIds, distinct, name, coverImage, data,
                ticketType,
                new GroupChannel.GroupChannelCreateHandler() {
                    @Override
                    public void onResult(GroupChannel groupChannel, SendBirdException e) {
                        if (e != null) {
                            // Error!
                            return;
                        }
                        createGroupChannelWithData1(managementIds, false, "Ticket Id:" + jobId, "", Integer.toString(jobId), "Ticket");

                    }
                });
    }

` private void createGroupChannelWithData1(List<String> userIds, boolean distinct, String name, String coverImage, String data, String ticketType) {
        GroupChannel.createChannelWithUserIds(userIds, distinct, name, coverImage, data,
                ticketType,
                new GroupChannel.GroupChannelCreateHandler() {
                    @Override
                    public void onResult(GroupChannel groupChannel, SendBirdException e) {
                        if (e != null) {
                            // Error!
                            return;
                        }
                        getGroupChannelList("end");

                    }
                });
    }

Edit: Channels are created in Sendbird Dashboard. enter image description here

But while I list the channels, I get only one channel, with custom type "Ticket". I need to get channel, with custom type "Private_Ticket" also. Everytime, I create two channels, and need the both to list in another app. My code to get the channel list:

GroupChannelListQuery channelListQuery = GroupChannel.createMyGroupChannelListQuery();
        channelListQuery.setIncludeEmpty(true);
        channelListQuery.setOrder(GroupChannelListQuery.Order.LATEST_LAST_MESSAGE);
        // CHRONOLOGICAL, LATEST_LAST_MESSAGE, CHANNEL_NAME_ALPHABETICAL, and METADATA_VALUE_ALPHABETICAL
        channelListQuery.setLimit(15);

        channelListQuery.next(new GroupChannelListQuery.GroupChannelListQueryResultHandler() {
            @Override
            public void onResult(List<GroupChannel> list, SendBirdException e) {
                if (e != null) {    // Error.
                    return;
                }
                for (int i = 0; i < list.size(); i++) {
                    Log.e(" in first loop name : data : custom type >>",list.get(i).getName()+" : "+list.get(i).getData()+" : "+list.get(i).getCustomType());

                }
            }
        });

Edit: The issue is fixed. I haven't include the user of the second app, in list. That's the root cause of the issue. thanks.

1

There are 1 answers

2
Jason Allshorn On

Great question you have. I hope I can help you with an answer.

The first step is to check if you channels are actually being created. You can do this in Sendbird's Dashboard.

Sendbird Dashboard --> Group Channels --> See channel list

If the channels don't show up in the Sendbird Dashboard then they haven't been created. In this case try logging any errors you see from the SDK when you were creating the channel.

If the channels were created and they are visibile in the Sendbird Dashboard, but are not showing up in your SDK please consider the following.

By default channels without any messages will not be displayed in a channel list query. 
Consider these to be "empty channels" 

If you need to be able to see empty channels in your channel list query then please include the setIncludeEmpty(true) parameter in your channel list query.

GroupChannelListQuery channelListQuery = GroupChannel.createMyGroupChannelListQuery();
   channelListQuery.setIncludeEmpty(true);
   channelListQuery.setOrder(GroupChannelListQuery.Order.LATEST_LAST_MESSAGE); 
   // CHRONOLOGICAL, LATEST_LAST_MESSAGE, CHANNEL_NAME_ALPHABETICAL, and METADATA_VALUE_ALPHABETICAL
   channelListQuery.setLimit(15);

   channelListQuery.next(new GroupChannelListQuery.GroupChannelListQueryResultHandler() {
   @Override
       public void onResult(List<GroupChannel> list, SendBirdException e) {
           if (e != null) {    // Error.
               return;
           }
       }
   });