All Products
Search
Document Center

Application Real-Time Monitoring Service:Sample configurations of the RUM SDK for Android

Last Updated:Dec 23, 2025

The Real User Monitoring (RUM) SDK for Flutter provides a wide variety of custom configurations to meet your business requirements. This topic describes the common SDK configurations of Android apps for reference purposes.

Startup

Important
  • To configure startup-specific interfaces, use method chaining. Example: AlibabaCloudRum.withServiceId(serviceId).withWorkspace(workspace).withEndpoint(endpoint).start(getApplicationContext());

  • You must configure startup-specific interfaces before the start method and after the withServiceId method.

  • You can configure multiple startup-specific interfaces at a time. Any configuration set after the start method is called has no effect.

Endpoint

Configure an endpoint for an app so that the monitoring data can be reported to the address.

AlibabaCloudRum withEndpoint(String endpoint)

Parameter

Description

Limit

Failure

endpoint

Endpoint that provides monitoring data

The string must be less than 2,083 characters in length.

The request fails, and the configuration does not take effect.

Workspace address

Each application must be associated with a workspace.

AlibabaCloudRum withEndpoint(String endpoint)

Custom device ID

You can use the following method to set a custom device ID. Then, the default device ID is no longer used.

AlibabaCloudRum withDeviceID(String deviceID)

Parameter

Description

Limit

Failure

deviceID

Custom device ID

The string must be less than 256 characters in length, and can contain only letters, digits, underscores (_), and hyphens (-).

The request fails, and the configuration does not take effect.

Custom app version number

You can use the following method to set a custom app version number. Then, the default version number is no longer used.

AlibabaCloudRum withAppVersion(String appVersion)

Parameter

Description

Limit

Failure

appVersion

Custom app version number

The string must be less than 64 characters in length.

The request fails, and the configuration does not take effect.

Channel ID

You can use the following method to differentiate between the release channels of the app.

AlibabaCloudRum withChannelID(String channelID)

Parameter

Description

Limit

Failure

channelID

Custom channel ID

The string must be less than 256 characters in length.

The request fails, and the configuration does not take effect.

Application environment

You can use the following method to differentiate between the application environments, such as LOCAL, DAILY, and PROD.

AlibabaCloudRum withEnvironment(Env env) 

Parameter

Description

Limit

Failure

env

Enumerated value of the application environment. Configure the withAppID method in advance.

Valid values:

  • LOCAL: local environment

  • DAILY: development environment

  • PRE: staging environment

  • GRAY: canary environment

  • PROD (default): production environment

  • NONE

The request fails, and the configuration does not take effect.

Custom information

Custom usernames

You can use the SDK to configure user information and further analyze monitoring data related to users.

void setUserName(String userName)

Parameter

Description

Limit

Failure

userName

Username

The string can be null or empty.

The string can be no more than 256 characters in length, and can only contain digits, letters, colons (:), spaces, forward slashes (/), underscores (_), hyphens (-), periods (.), and at signs (@).

The request fails, and the configuration does not take effect.

Custom additional user information

You can use the SDK to configure user information and further analyze monitoring data related to users.

void setUserExtraInfo(Map<String, Object> extraInfo)

Parameter

Description

Limit

Failure

extraInfo

Additional user information

The Map can be null or empty.

The JSON string can be no more than 7,000 characters in length. Otherwise, the request fails.

The request fails, and the configuration does not take effect.

Custom global attributes

After global attributes are customized, new data automatically carries the business attribute information, which is used to analyze requirements associated with the business attributes.

void setExtraInfo(Map<String, Object> extraInfo)

void addExtraInfo(Map<String, Object> extraInfo)

Parameter

Description

Limit

Failure

extraInfo

Attribute information

The Map can be null or empty. The JSON string can contain no more than 7,000 characters. Otherwise, the request fails.

The request fails, and the configuration does not take effect.

Note

The setExtraInfo method can be called to clear the previously configured attributes. The addExtraInfo method can be called to add new attributes.

Custom exceptions

You can pass in exception-specific parameters to collect custom exception data.

void setCustomException(Throwable exception) // (Recommended) Pass in exception objects or throwable objects.

Parameter

Description

Limit

Failure

exception

Exception object or throwable object

The value cannot be null.

The request fails, and the configuration does not take effect.

void setCustomException(String type, String causeBy, String errorDump)

Parameter

Description

Limit

Failure

type

Exception type (required)

The string can be no more than 256 characters in length.

The request fails, and the configuration does not take effect.

causeBy

Exception cause

The string can be null or empty.

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

N/A

errorDump

Exception information

The string can be null or empty.

The string can be no more than 10,000 characters in length. Otherwise, the string is truncated.

N/A

Custom events

You can pass in event-specific parameters to collect custom event data.

void setCustomEvent(String eventName)

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

void setCustomEvent(String eventName, String group)

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

void setCustomEvent(String eventName, String group, String snapshots)

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

snapshots

Event snapshots

The string can be null or empty.

The string can be no more than 7,000 characters in length. Otherwise, the string is truncated.

N/A

void setCustomEvent(String eventName, String group, double value) 

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

value

Event value

The value must be a data double.

N/A

void setCustomEvent(String eventName, String group, Map<String, Object> attributes) 

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

attributes

Key-value data

The JSON string can be no more than 7,000 characters in length.

N/A

void setCustomEvent(String eventName, String group, String snapshots, double value)

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

snapshots

Event snapshots

The string can be null or empty.

The string can be no more than 7,000 characters in length. Otherwise, the string is truncated.

N/A

value

Event value

The value must be a data double.

N/A

void setCustomEvent(String eventName, String group, String snapshots, Map<String, Object> attributes)

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

snapshots

Event snapshots

The string can be null or empty.

The string can be no more than 7,000 characters in length. Otherwise, the string is truncated.

N/A

attributes

Key-value data

The JSON string can be no more than 7,000 characters in length.

N/A

void setCustomEvent(String eventName, String group, double value, Map<String, Object> attributes)

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

value

Event value

The value must be a data double.

N/A

attributes

Key-value data

The JSON string can be no more than 7,000 characters in length.

N/A

void setCustomEvent(String eventName, String group, String snapshots, double value, Map<String, Object> attributes) 

Parameter

Description

Limit

Failure

eventName

Event name (required)

The string can be no more than 512 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

group

Event group

The string can be null or empty.

The string can be no more than 256 characters in length. Otherwise, the string is truncated.

N/A

snapshots

Event snapshots

The string can be null or empty.

The string can be no more than 7,000 characters in length. Otherwise, the string is truncated.

N/A

value

Event value

The value must be a data double.

N/A

attributes

Key-value data

The JSON string can be no more than 7,000 characters in length.

N/A

Custom logs

You can pass in log-specific parameters to collect custom log data.

void setCustomLog(String content)

Parameter

Description

Limit

Failure

content

Log information (required)

The string can be no more than 10,000 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

void setCustomLog(String content, String name) 

Parameter

Description

Limit

Failure

content

Log information (required)

The string can be no more than 10,000 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

name

Log name

The string can be no more than 256 characters in length.

N/A

void setCustomLog(String content, String name, String snapshots)

Parameter

Description

Limit

Failure

content

Log information (required)

The string can be no more than 10,000 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

name

Log name

The string can be no more than 256 characters in length.

N/A

snapshots

Log snapshots

The string can be null or empty.

The string can be no more than 7,000 characters in length. Otherwise, the string is truncated.

N/A

void setCustomLog(String content, String name, String snapshots, String level, Map<String, Object> attributes) 

Parameter

Description

Limit

Failure

content

Log information (required)

The string can be no more than 10,000 characters in length. Otherwise, the string is truncated.

The request fails, and the configuration does not take effect.

name

Log name

The string can be no more than 256 characters in length.

N/A

snapshots

Log snapshots

The string can be null or empty.

The string can be no more than 7,000 characters in length. Otherwise, the string is truncated.

N/A

level

Log level

The string can be no more than 256 characters in length. Default value: INFO.

N/A

info

Additional log information

The Map can be null or empty.

The length of the JSON string must be the same as that of the value of the content parameter. Otherwise, the request fails.

N/A