Agora Java API Reference for Android

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

`#include <IAgoraRtmService.h>`

## Public Member Functions
virtual int64_t | getMessageId () const =0
virtual int | getMessageType () const =0
virtual void | setText (const char *str)=0
virtual const char * | getText () const =0
virtual const unsigned char * | getRawMessageData () const =0
virtual int | getRawMessageLength () const =0
virtual void | setMessageType (int32_t type)=0
virtual void | setRawMessage (const uint8_t *data, int length)=0
virtual void | release ()=0

## Static Public Member Functions
static IMessage * | createMessage ()

## Detailed Description

The IMessage class.

## Member Function Documentation

## ◆ createMessage()

static IMessage* agora::rtm::IMessage::createMessage | ( |  | ) |
| static

Creates an IMessage instance.

The created IMessage instance can be either for a channel message or for a peer-to-peer message.

You can set the content of the text message later using the setText() method.

Returns
  - An empty text IMessage instance, if the method call succeeds.

## ◆ getMessageId()

virtual int64_t agora::rtm::IMessage::getMessageId | ( |  | ) | const
| pure virtual

Gets the ID of the message.

Returns
  The ID of the current IMessage instance.

## ◆ getMessageType()

virtual int agora::rtm::IMessage::getMessageType | ( |  | ) | const
| pure virtual

Gets the message type.

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

## ◆ setText()

virtual void agora::rtm::IMessage::setText | ( | const char * | str | ) |
| pure virtual

Sets the content of the text message, or the text description of the raw message.

Parameters

  str | The content of the text message, or the text description of the raw message. The maximum length is 32 KB.

## ◆ getText()

virtual const char* agora::rtm::IMessage::getText | ( |  | ) | const
| pure virtual

Gets the content of the text messsage, or the text description of the raw message.

Returns
  - The content of the text message or the text description of the raw message.

## ◆ getRawMessageData()

virtual const unsigned char* agora::rtm::IMessage::getRawMessageData | ( |  | ) | const
| pure virtual

Get pointer of custom raw message

Returns
  - The content of binary raw message

## ◆ getRawMessageLength()

virtual int agora::rtm::IMessage::getRawMessageLength | ( |  | ) | const
| pure virtual

Get length of custom raw message

Returns
  - The length of binary raw message in bytes

## ◆ setMessageType()

virtual void agora::rtm::IMessage::setMessageType | ( | int32_t | type | ) |
| pure virtual

Set message type

## ◆ setRawMessage()

virtual void agora::rtm::IMessage::setRawMessage | ( | const uint8_t * | data,
|  | int | length
| ) |  |
| pure virtual

Set raw binary message

## ◆ release()

virtual void agora::rtm::IMessage::release | ( |  | ) |
| pure virtual

Releases the IMessage instance.