此问题可能是由于未授权或未设置正确的频道类型而导致的。要解决此问题,请确保您的应用程序已授权使用该频道类型,并在创建频道时提供正确的参数。以下是创建对话类型频道的示例代码:
AmityChannelNotificationConfig notificationConfig = new AmityChannelNotificationConfig.Builder()
.setNotifyAllMembers(true)
.setNotifyNewMessage(true)
.setNotifyMessageEdited(true)
.setNotifyMessageDeleted(true)
.build();
AmityChannelOptions options = new AmityChannelOptions.Builder()
.setVisibility(AmityChannel.ChannelVisibility.PROTECTED)
.setChannelType(ChatChannel.TYPE_CHAT)
.setNotificationConfig(notificationConfig)
.build();
AmityChatClient.newChannel("channelId", options)
.setDisplayName("Channel Name")
.setMetaData("key1", "value1")
.create(new ResultListener() {
@Override
public void onSuccess(AmityChannel channel) {
// Channel created successfully
}
@Override
public void onError(Throwable error) {
// Handle error
}
});