Closed aghasi closed 5 years ago
This is the official description of useChatInfoDatabase:
If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies useFileDatabase.
You can ensure that all that data is persisted by successfully calling GetUser
/GetBasicGroup
/GetSupergroup
/GetSecretChat
. If you want to create a corresponding Chat
then you need to call CreatePrivateChat
/CreateBasicGroupChat
/CreateSupergroupChat
/CreateSecretChat
.
useChatInfoDatabase
is enabled as you can see in my code.
I'm working with channels. GetSupergroup
works great, but GetChatHistory
and OpenChat
not work at all. The response of calling them is
Error {
code = 6
message = "Chat not found"
}
It is interesting that chat data is not persisted when useMessageDatabase
is disabled while useChatInfoDatabase
is enabled. I know that useMessageDatabase
is irrelevant but it seems that it affect storing info of chats. So i think that it is a bug.
This is exactly as written in the documentation. useMessageDatabase
- "a cache of chats and messages.". useChatInfoDatabase
- "a cache of users, basic groups, supergroups, channels and secret chats".
So, without message database, you need to use CreatePrivateChat/CreateBasicGroupChat/CreateSupergroupChat/CreateSecretChat to recreate the chat from a corresponding user_id, basic_group_id, supergroup_id or secret_chat_id before you can use it.
This is the official description of
useMessageDatabase
:I'm using following parameter to initialize TDLib:
I except that TDLib stores chat info in database. But it does not. After restarting the program database of chat info is empty. It is surprising that it stores chat info is i set
useMessageDatabase
totrue
. The problem exists with both Android PreBuild and Compiled source code cloned from your GitHub repository!