Browse SDKs · Android
Platform
SDKsAndroid

Refresh subscribed user status

Retrieve current presence states and active platforms for all subscribed users.

Copy

Retrieve a current presence snapshot for all users currently subscribed by this client. This is used to refresh screen states or calibrate presence data on demand.

Code example

OpenIMClient.getInstance().userInfoManager.getSubscribeOnlineUsersStatus(
    new OnBase<List<UsersOnlineStatus>>() {
        @Override
        public void onSuccess(List<UsersOnlineStatus> states) {
            // Render presence indicators using states
        }

        @Override
        public void onError(int code, String error) {
            // Handle error
        }
    }
);

Parameters

ParameterTypeRequiredDescription
baseOnBase<List<UsersOnlineStatus>>YesCallback delivering the asynchronous operation result.

Return value

The successful callback returns the presence snapshot as List<UsersOnlineStatus>. Maintain your local cache using userID as the unique key:

FieldDescription
userIDTarget user ID.
statusPresence status (1 for online, 0 for offline).
platformIDsList of active client platforms (such as Android, iOS, or Web platform codes).

To subscribe to additional users or terminate existing subscriptions, see Subscribe to user status and Unsubscribe from user status.