# Use of onTotalUnread MessageCountChanged()

**URL:** <https://community.sendbird.com/t/use-of-ontotalunread-messagecountchanged/9610>\
**Category:** React Native\
**Created:** [June 2, 2024, 9:56am UTC](https://community.sendbird.com/t/use-of-ontotalunread-messagecountchanged/9610 "2024-06-02T09:56:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_N](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/david_n/32/5221_2.png) [@David\_N](https://community.sendbird.com/u/David_N)\
**Post date:** [June 2, 2024, 9:56am UTC](https://community.sendbird.com/t/use-of-ontotalunread-messagecountchanged/9610/1 "2024-06-02T09:56:07Z")

</div>

**[Problem/Question]**  
In my React Native app I would like to use onTotalUnreadMessageCountChanged to listen for new unread messages in order to update my in-app badge counter

However from looking at previous comments about this function and speaking to the Docs AI chatbot - it seems I have to request this feature to be enabled on my account?

Is this true? Is it available on the Developer plan?

 ![Screenshot 2024-06-02 at 10.51.17](https://us1.discourse-cdn.com/flex020/uploads/sendbird/original/2X/8/864528f5ce740e062634c2afeb36e72b5d32c07d.png)

```auto
useEffect(() => {
        const userEventHandler = new UserEventHandler({
            onTotalUnreadMessageCountChanged: (unreadMessageCount) => {
                console.log("New count: "+unreadMessageCount)
                // Update totalUnreadMessageCount state
            },
        });
          
        sdk.addUserEventHandler(SendbirdConstants.TOTAL_UNREAD_MSG_COUNT_UNIQUE_HANDLER_ID, userEventHandler);
        const getTotalUnreadMessageCount = async() => {
            var umc = await sdk.groupChannel.getTotalUnreadMessageCount()
            setTotalUnreadMessageCount(umc)
        }

        getTotalUnreadMessageCount()

        return sdk.removeUserEventHandler(SendbirdConstants.TOTAL_UNREAD_MSG_COUNT_UNIQUE_HANDLER_ID);
    },[])

```

* * *

// If problem, please fill out the below. If question, please delete.  
**[UIKit Version]**  
@sendbird/chat": “^4.12.6”,  
@sendbird/uikit-react-native": “^3.5.3”,

**[Reproduction Steps]**  
Code implementation in description

**[Frequency]**  
N/A

**[Current impact]**  
N/A
