Join / Leave Channel
1. Join Channel
Anyone can join a public channel even without invitation from the owner.
TalkPlus.joinChannel(channelId,
new TalkPlus.CallbackListener<TPChannel>() {
@Override
public void onSuccess(TPChannel tpChannel) {
}
@Override
public void onFailure(int errorCode, Exception exception) {
}
}
);
TalkPlus.joinChannel(channelId,
object : TalkPlus.CallbackListener<TPChannel>() {
override fun onSuccess(tpChannel: TPChannel) { }
override fun onFailure(errorCode: Int, exception: Exception) { }
})
2. Join InvitationOnly Channel
In order to join an invitationOnly channel, you need to know the channel’s invitationCode.
TalkPlus.joinChannel(channelId,
invitationCode,
new TalkPlus.CallbackListener<TPChannel>() {
@Override
public void onSuccess(TPChannel tpChannel) {
}
@Override
public void onFailure(int errorCode, Exception exception) {
}
}
);
TalkPlus.joinChannel(channelId,
invitationCode,
object : TalkPlus.CallbackListener<TPChannel>() {
override fun onSuccess(tpChannel: TPChannel) { }
override fun onFailure(errorCode: Int, exception: Exception) { }
})
3. Leave Channel
If you are the last remaining channel member and you set deleteChannelIfEmpty
parameter to true when leaving the channel, the channel will be deleted.
TalkPlus.leaveChannel(channel,
deleteChannelIfEmpty,
new TalkPlus.CallbackListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
}
@Override
public void onFailure(int errorCode, Exception exception) {
}
}
)
TalkPlus.leaveChannel(channel,
deleteChannelIfEmpty,
object : TalkPlus.CallbackListener<Void?>() {
override fun onSuccess(aVoid: Void?) { }
override fun onFailure(errorCode: Int, exception: Exception) { }
})
Last updated