# SyncManager onChannelChanged not triggered when changing custom type

**URL:** https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897
**Category:** Android
**Created:** [September 4, 2020, 10:31am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897 "2020-09-04T10:31:12Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![wisnup](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/wisnup/32/689_2.png) [@wisnup](https://community.sendbird.com/u/wisnup)
#### Post date: [September 4, 2020, 10:31am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/1 "2020-09-04T10:31:13Z")

</div>

The onChannelChanged not triggered at all when changing custom type even though from the doc said supported [Channel sync | SyncManager Android SDK | Sendbird Docs](https://docs.sendbird.com/android/sync_manager_channel_sync)

> onChannelChanged - One of the following group channel properties has been changed: distinct, push notification preferences, last message (excluding silent admin messages), unread message count, name, cover image, data, or custom type. If the collection doesn’t have the channel in the channel list, an **insert** event is given instead of **update**. If the property change affects the order of the channel list, the **move** event is also invoked.

Is this a bug from the Android SDK?

---

<div class="post-metadata">

### Author: ![Doo\_Rim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/doo_rim/32/239_2.png) [@Doo\_Rim](https://community.sendbird.com/u/Doo_Rim)
#### Post date: [September 7, 2020, 1:19am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/2 "2020-09-07T01:19:32Z")

</div>

hi, @wisnup

How did you try to update custom type?! I checked `ChannelEventAction.UPDATE` is called when channel custom type is updated.

You can update channel custom type like below.

```
GroupChannelParams params = new GroupChannelParams().setCustomType("your type");
channel.updateChannel(params, new GroupChannel.GroupChannelUpdateHandler() {
@Override
 public void onResult(GroupChannel groupChannel, SendBirdException e) {
       if (e != null) {
             Logger.d("error");
        }
        Logger.d("updated custom type");
     }
 });
```

---

<div class="post-metadata">

### Author: ![wisnup](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/wisnup/32/689_2.png) [@wisnup](https://community.sendbird.com/u/wisnup)
#### Post date: [September 7, 2020, 1:51am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/3 "2020-09-07T01:51:39Z")

</div>

The update comes from back-end. Below’s the code. Also we can update the custom type directly from Sendbird Dashboard.

```
 public static updateChannel(
    channel: SendBird.GroupChannel,
    feedbackData?: FeedbackData,
  ): Promise<SendBird.GroupChannel> {
    return new Promise((resolve, reject) => {
      const parsedData = this.safelyParseJSON(channel.data);
      const newData = !!feedbackData
        ? JSON.stringify({ ...parsedData, ...feedbackData })
        : channel.data;
      channel.updateChannel(
        false,
        channel.name,
        channel.coverUrl,
        newData,
        'NEW_CUSTOM_TYPE',
        (response, error) => {
          if (error) {
            reject(error);
          }

          resolve(response);
        },
      );
    });
  }
```

---

<div class="post-metadata">

### Author: ![Doo\_Rim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/doo_rim/32/239_2.png) [@Doo\_Rim](https://community.sendbird.com/u/Doo_Rim)
#### Post date: [September 7, 2020, 2:08am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/4 "2020-09-07T02:08:53Z")

</div>

Did you check your log?!

I have successfully received the update event.  
You have to define your `ChannelCollectionHandler` and set it on your collection.  
You can get `UPDATE` event from `ChannelCollectionHandler`.

```
GroupChannelListQuery query = GroupChannel.createMyGroupChannelListQuery();
query.setLimit(CHANNEL_LIST_LIMIT);
mChannelCollection = new ChannelCollection(query);
mChannelCollection.setCollectionHandler(mChannelCollectionHandler);
```

---

<div class="post-metadata">

### Author: ![wisnup](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/wisnup/32/689_2.png) [@wisnup](https://community.sendbird.com/u/wisnup)
#### Post date: [September 7, 2020, 2:13am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/5 "2020-09-07T02:13:01Z")

</div>

Yeah we checked our log. The query code is similar to yours but we also add custom type filter.

> mChannelCllection.query.customTypesFilter = customTypes

Is it works with the filter? If we change the custom type from it (the one set as filter) to another custom type and vice versa?

---

<div class="post-metadata">

### Author: ![wisnup](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/wisnup/32/689_2.png) [@wisnup](https://community.sendbird.com/u/wisnup)
#### Post date: [September 7, 2020, 4:21am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/6 "2020-09-07T04:21:53Z")

</div>

Ah I think the exact problem is like this:

1. Create a channel collection with custom type filter ‘A’
2. Change a channel custom type from ‘A’ to ‘B’. Event is not triggered.
3. But if we change from ‘B’ to ‘A’ the event is triggered.

Is this a feature or bug?

---

<div class="post-metadata">

### Author: ![Doo\_Rim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/doo_rim/32/239_2.png) [@Doo\_Rim](https://community.sendbird.com/u/Doo_Rim)
#### Post date: [September 7, 2020, 6:01am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/7 "2020-09-07T06:01:08Z")

</div>

This is a feature. We collect channels based on query. If you set the custom type filter, query can get channels only filtered by customers. If you want to hide a channel, you can use hide method.

> **[Group Channel | Android Chat SDK Documentation | Sendbird](https://docs.sendbird.com/android/group_channel#3_hide_or_archive_a_channel_from_a_list_of_channels)**
>
> A group channel is a chat that allows close interactions among a limited number of users. It can be private or public. A private group channel can let a user join the chat through an invitation by another user who is already a member of the chatroom....

---

<div class="post-metadata">

### Author: ![wisnup](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/wisnup/32/689_2.png) [@wisnup](https://community.sendbird.com/u/wisnup)
#### Post date: [September 7, 2020, 6:30am UTC](https://community.sendbird.com/t/syncmanager-onchannelchanged-not-triggered-when-changing-custom-type/897/8 "2020-09-07T06:30:25Z")

</div>

Okay then, understood. Thanks for replying @Doo_Rim 😃 👍
