How can i store chat offline in Android

873 Views Asked by At

I am using Socket.io for sends and receives messages. I want to store the Chatting history among the users.

What is the best possible way to maintain the chat history and any snippets will be of great help.

2

There are 2 best solutions below

1
On

You can store it in local database link SQLite or Android Room.

You can follow this reference link for integrating Android Room : https://developer.android.com/topic/libraries/architecture/adding-components.html

Use this reference link for SQLite : https://developer.android.com/training/data-storage/sqlite.html

Thanks.

0
On

You can either write to a file and load from their when required. Or the other way around would be to use SQLite database to store the messages on the individual device.