I'm working on project in which I need to read the firebase node in this manner:
Suppose I have a node messages
in a firebase realtime database. In that node, I have 20, 000
messages.
When a user enter in the message box, I need to show messages. But Its too time consuming to read all 20, 000
messages at a time.
What I want it, to read 30-40
messages at a time and show those to the user.
When user press more message
button, I will read another 30-40
messages and show them to users. and so on.... it would faster and convenient.
But I can't find any way to make the things work like this.
I tried with ValueEventListener()
, but it reads all the data in that messages
node and it's time consuming. I also tried reference.limitToFirst(30)
but it read first 30 messages, then what do I do? How can I read next 30 messages?
Could I have present my problem clearly? :( Thanks in advance.