Agora Java API Reference for Android

Public Member Functions | List of all members
agora::rtm::IChannel Class Referenceabstract

`#include <IAgoraRtmService.h>`

## Public Member Functions
virtual int | setEventHandler (IChannelEventHandler *eventHandler, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | join (aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | leave (aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | sendMessage (const IMessage *message, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | updateAttributes (IChannelAttributes *attributes, int64_t &requestId, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | deleteAttributes (IChannelAttributes *attributes, int64_t &requestId, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual const char * | getId () const =0
virtual int | release ()=0

## Detailed Description

The IChannel class.

## Member Function Documentation

## ◆ setEventHandler()

virtual int agora::rtm::IChannel::setEventHandler | ( | IChannelEventHandler * | eventHandler,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Sets an event handler for IChannel.

Parameters

  eventHandler | The pointer to the event handler of IChannel: IChannelEventHandler.

## ◆ join()

virtual int agora::rtm::IChannel::join | ( | aosl_ref_t | ares = `AOSL_REF_INVALID` | ) |
| pure virtual

Joins the current channel.

A successful method call triggers either onJoinSuccess() or onJoinFailure() on the local client, to report the state of joining the channel.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ leave()

virtual int agora::rtm::IChannel::leave | ( | aosl_ref_t | ares = `AOSL_REF_INVALID` | ) |
| pure virtual

Leaves the current channel.

After the local user successfully leaves the channel, the SDK triggers the onLeave() on the local client.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ sendMessage()

virtual int agora::rtm::IChannel::sendMessage | ( | const IMessage * | message,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Sends a channel message.

After you successfully send a channel message, all members in the channel receive the message in the onMessageReceived() callback.

Parameters

  message | The pointer to the channel message that you want to send: IMessage.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ updateAttributes()

virtual int agora::rtm::IChannel::updateAttributes | ( | IChannelAttributes * | attributes,
|  | int64_t & | requestId,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Updates the channel attributes.

A successful method call triggers the onUpdateAttributesResponse() callback on the local client.

Parameters

  attributes | The pointer to the channel attributes that you want to update: IChannelAttributes.
  requestId | ID of the current update request.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ deleteAttributes()

virtual int agora::rtm::IChannel::deleteAttributes | ( | IChannelAttributes * | attributes,
|  | int64_t & | requestId,
|  | aosl_ref_t | ares = `AOSL_REF_INVALID`
| ) |  |
| pure virtual

Removes the channel attributes.

A successful method call triggers the onDeleteAttributesResponse() callback on the local client.

Parameters

  attributes | The pointer to the channel attributes that you want to remove: IChannelAttributes.
  requestId | ID of the current delete request.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getId()

virtual const char* agora::rtm::IChannel::getId | ( |  | ) | const
| pure virtual

Gets the current request ID.

Returns
  - The pointer to the request ID, if the method call succeeds.
  - An empty pointer NULL, if the method call fails.

## ◆ release()

virtual int agora::rtm::IChannel::release | ( |  | ) |
| pure virtual

Releases the IChannel instance.

This is a synchronous method call, which means that the SDK reports the result of this method call after the IChannel instance is successfully released.

Returns
  - 0: Success.
  - < 0: Failure.