Please help me on this

I am trying to create a new group channel from my fragment… please see this below code…

GroupChannelParams params = new GroupChannelParams()
        .setPublic(false).setEphemeral(false)
        .setDistinct(true).setSuper(false)
        .addUserIds(users).setOperatorUserIds(operators);
GroupChannel.createChannel(params,  new GroupChannel.GroupChannelCreateHandler() {
    @Override
    public void onResult(GroupChannel groupChannel, SendBirdException e) {
        if (e != null) {
            e.printStackTrace();
        }
        String channelUrl = groupChannel.getUrl();
        /*Intent intent = new Intent(getActivity(), GroupChannelMainActivity.class);
        intent.putExtra(PUSH_REDIRECT_CHANNEL, channelUrl);
        startActivity(intent);*/
        Intent intent = CustomChannelActivity.newIntentFromCustomActivity(getActivity(), CustomChannelActivity.class, channelUrl);
        startActivity(intent);
        getActivity().finish();
    }
});

so this code is perfectly working if the android studio is in debug mode…but if the code is in Run, this throws an exception saying the user is not connected, Connection must be made.

any clue, why this code is not working in run mode, but success in debug mode…seems some delayed response causing problem…please help me

Hi @sakkk,

Is there any potential for your connection to be delayed while not in debug mode? It seems like the most logical way forward would be to wait until the connection has been made to make your calls.

Hi, @sakkk
Could you let me know where you put your codes?!
Our UIKit fragment components try to connect Sendbird server when onViewCreated calls.

  1. Do you use our UIKit fragment? → Then, you need to call your codes after onReady()
  2. Do you use your own fragment? → You should implement connect()

You mean, SendBirdUIKit.connect((user, e) → {}
I implemented this connect before the channel creation, but even though I am facing the problem…I have my own fragment, from that fragment I am calling the above-said codes.

Did you implement the channel creation code after connect() callback succeeded?

can you please share a code snippet for this connect() callback …it would be helpful

Any update on this …?

@sakkk

// The USER_ID below should be unique to your Sendbird application.
SendBird.connect(USER_ID, new SendBird.ConnectHandler() {
    @Override
    public void onConnected(User user, SendBirdException e) {
        if (e != null) {
            // Handle error. 
        }
        // The user is connected to Sendbird server.    
        // Attach your codes.
    }
});