# Is there any way to enable chat history programmatically in android

**URL:** <https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885>\
**Category:** Android\
**Tags:** android\
**Created:** [July 19, 2023, 1:41pm UTC](https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885 "2023-07-19T13:41:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mayank\_Ingle](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/mayank_ingle/32/4292_2.png) [@Mayank\_Ingle](https://community.sendbird.com/u/Mayank_Ingle)\
**Post date:** [July 19, 2023, 1:41pm UTC](https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885/1 "2023-07-19T13:41:21Z")

</div>

can we enable history of any group channel by code in android (java)

* * *

// If problem, please fill out the below. If question, please delete.  
**[UIKit Version = 3.4.5]**  
// What version of the SDK are you using?  
min 23  
max 33

---

<div class="post-metadata">

**Author:** ![rahul](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@rahul](https://community.sendbird.com/u/rahul)\
**Post date:** [July 19, 2023, 5:20pm UTC](https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885/2 "2023-07-19T17:20:06Z")

</div>

Hello @Mayank_Ingle ,

Yes, you can enable the history of a group channel by code in Android (Java). You can use the `setChannelHiddenState()` method to enable or disable the history of a group channel. Here’s an example of how you can enable the history of a group channel:

GroupChannelParams params = new GroupChannelParams()  
.setChannelUrl(“CHANNEL\_URL”)  
.setHiddenState(false); // Set hidden state to false to enable history

GroupChannel.createChannel(params, new GroupChannel.GroupChannelCreateHandler() {  
@Override  
public void onResult(GroupChannel groupChannel, SendBirdException e) {  
if (e != null) {  
// Handle error  
} else {  
// History enabled successfully  
}  
}  
});

Note: Make sure to replace “CHANNEL\_URL” with the actual URL of the group channel you want to enable the history for.

Let me know if this helps.

---

<div class="post-metadata">

**Author:** ![Mayank\_Ingle](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/mayank_ingle/32/4292_2.png) [@Mayank\_Ingle](https://community.sendbird.com/u/Mayank_Ingle)\
**Post date:** [July 20, 2023, 5:11am UTC](https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885/3 "2023-07-20T05:11:55Z")

</div>

am not able to implement setHiddenState in my code as is says Cannot resolve symbol ‘setHiddenState’

am using SendbirdUIkit ;

dependency integradted is ‘com.sendbird.sdk:uikit:3.6.0’

my code 👎

GroupChannelCreateParams groupChannelCreateParams = new GroupChannelCreateParams();  
groupChannelCreateParams.setName(partyTitle);  
groupChannelCreateParams.setCoverUrl(creater.getProfilePic());  
groupChannelCreateParams.setChannelUrl(groupUrl);  
groupChannelCreateParams.setOperatorUserIds(operators);  
groupChannelCreateParams.setDistinct(false);  
groupChannelCreateParams.setPublic(true);

---

<div class="post-metadata">

**Author:** ![rahul](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@rahul](https://community.sendbird.com/u/rahul)\
**Post date:** [July 21, 2023, 7:05pm UTC](https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885/4 "2023-07-21T19:05:00Z")

</div>

Hello Mayank,

I will checking more on it. In meantime can you let me know if there is any reason you don’t want to enable it on Sendbird Dashboard by going to → Settings \> Chat \> Channels \> Group channels \> Chat history ?

---

<div class="post-metadata">

**Author:** ![Mayank\_Ingle](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/mayank_ingle/32/4292_2.png) [@Mayank\_Ingle](https://community.sendbird.com/u/Mayank_Ingle)\
**Post date:** [July 24, 2023, 7:03am UTC](https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885/5 "2023-07-24T07:03:21Z")

</div>

> [@rahul](#):
>
> Sendbird Dashboard by going to → Settings \> Chat \> Channels \> Group channels \> Chat history

well i had done this process too but when a new user joins a group he is not able to view previous chat log .

---

<div class="post-metadata">

**Author:** ![rahul](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@rahul](https://community.sendbird.com/u/rahul)\
**Post date:** [July 25, 2023, 1:48pm UTC](https://community.sendbird.com/t/is-there-any-way-to-enable-chat-history-programmatically-in-android/7885/6 "2023-07-25T13:48:53Z")

</div>

Hello @Mayank_Ingle,

In this case, you will need to check if there is a channel custom\_type setting “display\_past\_message” and it’s set to false.  
This needs to be set as true.

Let me know if this helps.
