简体   繁体   中英

How can I get the list of Open Channels more than 1000 in android using the SendBird SDK?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM