Chat SDK for Android v1.2.1
agora java chat SDK
Classes | Public Member Functions | List of all members
io.agora.chat.ChatStatisticsManager Class Reference

Inherits io.agora.chat.EMBase< T >.

Classes

enum  SearchMessageDirect
 
enum  SearchMessageType
 

Public Member Functions

MessageStatistics getMessageStatistics (String messageId)
 
int getMessageCount (long startTimestamp, long endTimestamp, SearchMessageDirect direct, SearchMessageType type)
 
long getMessageSize (long startTimestamp, long endTimestamp, SearchMessageDirect direct, SearchMessageType type)
 

Detailed Description

The class for traffic statistics management of local messages.

This class contains methods that are used to calculate the number of local messages of certain types sent and/or received in a specified period, as well as their traffic.

This traffic statistics function is disabled by default. To use this function, you need to enable it by setting ChatOptions#setEnableStatistics(boolean) prior to the SDK initialization.

The SDK only calculates the traffic of messages that are sent and received within the last 30 days after the traffic statistics function is enabled.

The message traffic is calculated as follows:

Note

  1. For messages with attachments, the traffic will be calculated only if the download is successful. If an attachment is downloaded multiple times, its download traffic will be accumulated.
  2. For roaming messages pulled from the server, if they already exist in the local database, the SDK ignores them during traffic calculation.

The SDK only measures the traffic of local messages, but not the actual message traffic. Generally, the calculated traffic volume is smaller than the actual traffic because of the following:

Member Function Documentation

◆ getMessageCount()

int io.agora.chat.ChatStatisticsManager.getMessageCount ( long  startTimestamp,
long  endTimestamp,
SearchMessageDirect  direct,
SearchMessageType  type 
)

Gets the count of messages of certain types that are sent and/or received in a specified period.

Parameters
startTimestampThe starting timestamp for statistics. The unit is millisecond.
endTimestampThe ending timestamp for statistics. The unit is millisecond.
directThe message direction.
typeThe message type.
Returns
The count of messages that meet the statistical conditions. 0 is returned in the case of a call failure.

◆ getMessageSize()

long io.agora.chat.ChatStatisticsManager.getMessageSize ( long  startTimestamp,
long  endTimestamp,
SearchMessageDirect  direct,
SearchMessageType  type 
)

Gets the total traffic volume of messages of certain types that are sent and/or received in a specified period.

The traffic is measured in bytes.

The message traffic is calculated as follows:

  • For a text, command, location, or custom message, the message traffic is the traffic of the message body.
  • For an image or video message, the message traffic is the traffic sum of the message body, the image or video file, and the thumbnail.
  • For a file or voice message, the message traffic is the traffic sum of the message body and the attachment.
Parameters
startTimestampThe starting timestamp for statistics. The unit is millisecond.
endTimestampThe ending timestamp for statistics. The unit is millisecond.
directThe message direction.
typeThe message type.
Returns
The total traffic volume of messages that meet the statistical conditions. 0 is returned in the case of a call failure.

◆ getMessageStatistics()

MessageStatistics io.agora.chat.ChatStatisticsManager.getMessageStatistics ( String  messageId)

Gets message traffic statistics by message ID.

Parameters
messageIdThe message ID.
Returns
The message traffic statistics. See MessageStatistics.

The documentation for this class was generated from the following file: