Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.rtm.RtmPresence Class Referenceabstract

## Public Member Functions
abstract void | whoNow (String channelName, RtmChannelType channelType, PresenceOptions options, ResultCallback< WhoNowResult > resultCallback)
abstract void | whereNow (String userId, ResultCallback< ArrayList< ChannelInfo >> resultCallback)
abstract void | getOnlineUsers (String channelName, RtmChannelType channelType, GetOnlineUsersOptions options, ResultCallback< GetOnlineUsersResult > resultCallback)
abstract void | getUserChannels (String userId, ResultCallback< ArrayList< ChannelInfo >> resultCallback)
abstract void | setState (String channelName, RtmChannelType channelType, Map< String, String > items, ResultCallback< Void > resultCallback)
abstract void | removeState (String channelName, RtmChannelType channelType, ArrayList< String > keys, ResultCallback< Void > resultCallback)
abstract void | getState (String channelName, RtmChannelType channelType, String userId, ResultCallback< UserState > resultCallback)

## Detailed Description

The RtmPresence class.

This class provides the rtm presence methods that can be invoked by your app.

## Member Function Documentation

## ◆ whoNow()

abstract void io.agora.rtm.RtmPresence.whoNow | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | PresenceOptions | options,
|  | ResultCallback< WhoNowResult > | resultCallback
| ) |  |
| abstract

To query who joined this channel

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  options | The query option.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ whereNow()

abstract void io.agora.rtm.RtmPresence.whereNow | ( | String | userId,
|  | ResultCallback< ArrayList< ChannelInfo >> | resultCallback
| ) |  |
| abstract

To query which channels the user joined

Parameters

  userId | The id of the user.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ getOnlineUsers()

abstract void io.agora.rtm.RtmPresence.getOnlineUsers | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | GetOnlineUsersOptions | options,
|  | ResultCallback< GetOnlineUsersResult > | resultCallback
| ) |  |
| abstract

To query who joined this channel

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  options | The query option.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ getUserChannels()

abstract void io.agora.rtm.RtmPresence.getUserChannels | ( | String | userId,
|  | ResultCallback< ArrayList< ChannelInfo >> | resultCallback
| ) |  |
| abstract

To query which channels the user joined or subscribed

Parameters

  userId | The id of the user.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ setState()

abstract void io.agora.rtm.RtmPresence.setState | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | Map< String, String > | items,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Set user state

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  items | The states item of user.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ removeState()

abstract void io.agora.rtm.RtmPresence.removeState | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | ArrayList< String > | keys,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

Delete user state

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  keys | The keys of state item.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ getState()

abstract void io.agora.rtm.RtmPresence.getState | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | String | userId,
|  | ResultCallback< UserState > | resultCallback
| ) |  |
| abstract

Get user state

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  userId | The id of the user.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.