After updating nickname, other users still gets previous nickname from the chat

after setting nicknames in both devices using

 SendBird.updateCurrentUserInfo(userNickname, null,
        SendBird.UserInfoUpdateHandler { e ->
            if (e != null) {
                // Error!
                Toast.makeText(
                    activity, "" + e.code + ":" + e.message,
                    Toast.LENGTH_SHORT
                ).show()

                return@UserInfoUpdateHandler
            }
            HawkDB.setUserNickName(userNickname)
        })

sending message other user getting previous name only.


same happens to another device.

Another strange behavior is when going back and coming again to this page showing correct name but sending message again makes all the other user’s messages nickname to previous one.

Handling message receiving using below codes:

SendBird.addChannelHandler(
        CHANNEL_HANDLER_ID,
        object : ChannelHandler() {

            override fun onMessageReceived(baseChannel: BaseChannel, baseMessage: BaseMessage) {
                if (baseChannel.url == channelUrl) {
                    groupChatAdapter.markAllMessagesAsRead()
                    // Add new message to view
                    groupChatAdapter.addFirst(baseMessage)
                }
            }
        })

Please help me to resolve this. Thank you.

Hi @Axay_Prajapati ,

I could not see anything wrong in your code for calling updateCurrentUserInfo() function.
Could you check the function HawkDB.setUserNickName(userNickname)?
Also, could you check the user info to see if the user info was updated correctly via API?

If the user’s nickname was updated successfully, you may check your UI display part.

This article might help you to resolve your issue. Please refer to the following.