1

I am trying to use ConnectyCube Android and iOS SDKs to build my apps and need to be be able to assign admins for chats. For Android I tried this code:

    ArrayList<Integer> occupantIds = new ArrayList<Integer>();
occupantIds.add(34);
occupantIds.add(35);
occupantIds.add(36);

ConnectycubeChatDialog dialog = new ConnectycubeChatDialog();
dialog.setType(ConnectycubeDialogType.GROUP);
dialog.setOccupantsIds(occupantIdsList);
dialog.setName("Hawaii party");

//or just use DialogUtils
//ConnectycubeChatDialog dialog = DialogUtils.buildDialog("Hawaii party", ConnectycubeDialogType.GROUP, occupantIds);

ConnectycubeRestChatService.createChatDialog(dialog).performAsync(new EntityCallback<ConnectycubeChatDialog>() {
    @Override
    public void onSuccess(ConnectycubeChatDialog createdDialog, Bundle params) {

    }

    @Override
    public void onError(ResponseException exception) {

    }
});

but I don't see how I can indicate admins there. Is it possible? Thank you.

1 Answers1

0

Add admins:

DialogRequestBuilder updateBuilder = new DialogRequestBuilder();
updateBuilder.addAdminsIds(17616, 17617);
ConnectycubeRestChatService.updateChatDialog(groupDialog, updateBuilder).performAsync(new EntityCallback<ConnectycubeChatDialog>() {
    @Override
    public void onSuccess(ConnectycubeChatDialog result, Bundle params) {

    }

    @Override
    public void onError(ResponseException responseException) {

    }
});

Remove admins:

DialogRequestBuilder updateBuilder = new DialogRequestBuilder();
updateBuilder.removeAdminsIds(17616, 17617);
ConnectycubeRestChatService.updateChatDialog(groupDialog, updateBuilder).performAsync(new EntityCallback<ConnectycubeChatDialog>() {
    @Override
    public void onSuccess(ConnectycubeChatDialog result, Bundle params) {

    }

    @Override
    public void onError(ResponseException responseException) {

    }
});

More info here https://developers.connectycube.com/android/messaging?id=addremove-admins

Rubycon
  • 18,156
  • 10
  • 49
  • 70