Hi,
Correct me if i’m wrong but the only way to know if a user is online or offline is by using this code as mentioned in the doc
ArrayList<String> userIds = new ArrayList<>();
userIds.add("Jeff");
ApplicationUserListQuery listQuery = SendBird.createApplicationUserListQuery();
listQuery.setUserIdsFilter(userIds);
listQuery.next(new UserListQuery.UserListQueryResultHandler() {
@Override
public void onResult(List<User> list, SendBirdException e) {
if (e != null) {
// Handle error.
}
// list.get(0) = 'Jeff'
if (list.get(0).getConnectionStatus() == User.ConnectionStatus.ONLINE) {
// 'Jeff' is currently online.
// User.ConnectionStatus consists of NON_AVAILABLE, ONLINE, and OFFLINE.
...
}
}
});
and if i need a more realtime approach then i need to follow this as mentioned in the doc
it says that i need to have a mechanism wherein i’d be calling the next()
function periodically, perhaps in intervals of one minute or more.
My question is how can i achieve the realtime-ness if i’ll be hitting every 1 minute or so, a user can switch back and forth from the app multiple times in a span of a minute and i won’t be notified of those events.