I'm developing the chatting application using the SendBird SDK in android studio.
How can I get the list of Open Channels more than 1000?
You can create use an OpenChannelListQuery
to traverse through your list of channels in fixed chunks.
OpenChannelListQuery query = OpenChannel.createOpenChannelListQuery();
query.setLimit(30);
query.next(new OpenChannelListQuery.OpenChannelListQueryResultHandler() {
@Override
public void onResult(List<OpenChannel> list, SendBirdException e) {
if (e != null) {
// Error!
}
// list contains the first 30 channels.
}
});
As long as your query
instance is the same, you can call query.next()
until you obtain as many channels as you want.
query.next(new OpenChannelListQuery.OpenChannelListQueryResultHandler() {
@Override
public void onResult(List<OpenChannel> list, SendBirdException e) {
// list contains the next 30 channels.
}
});
Edit: I forgot to mention that the first query.next()
must be completely finished before you can call query.next()
again. That is, make sure the first onResult()
is called before calling query.next()
again.