This document describes the APIs provided by the Android Memory Analysis SDK.
Add custom dimensions
The Memory Analysis SDK provides APIs for customizing dimension data.
A single log report can contain a maximum of 64 key-value pairs.
setCustomKey
The value to add is a boolean.
API definition
void setCustomKey(@NonNull String key, boolean value)
Class
ApmMemMonitor
Parameters
Parameter | Type | Required | Description |
key | String | Yes | The key. The maximum length is 1024 characters. The key is truncated if it exceeds this length. |
value | boolean | Yes | The value. |
setCustomKey
Adds data of the double type.
API definition
void setCustomKey(@NonNull String key, double value)
Class
ApmMemMonitor
Parameters
Parameter | Type | Required | Description |
key | String | Yes | The key. The maximum length is 1024 characters. The key is truncated if it exceeds this length. |
value | double | Yes | The value. |
setCustomKey
The added value is a float.
API definition
void setCustomKey(@NonNull String key, float value)
Class
ApmMemMonitor
Parameters
Parameter | Type | Required | Description |
key | String | Yes | The key. The maximum length is 1024 characters. The key is truncated if it exceeds this length. |
value | float | Yes | The value. |
setCustomKey
The value to add is an int.
API definition
void setCustomKey(@NonNull String key, int value)
Class
ApmMemMonitor
Parameters
Parameter | Type | Required | Description |
key | String | Yes | The key. The maximum length is 1024 characters. The key is truncated if it exceeds this length. |
value | int | Yes | The value. |
setCustomKey
Adds data of the long type.
API definition
void setCustomKey(@NonNull String key, long value)
Class
ApmMemMonitor
Parameters
Parameter | Type | Required | Description |
key | String | Yes | The key. The maximum length is 1024 characters. The key is truncated if it exceeds this length. |
value | long | Yes | The value. |
setCustomKey
Adds data of the String type.
API definition
void setCustomKey(@NonNull String key, @NonNull String value)
Class
ApmMemMonitor
Parameters
Parameter | Type | Required | Description |
key | String | Yes | The key. The maximum length is 1024 characters. The key is truncated if it exceeds this length. |
value | String | Yes | The value. The maximum length is 1024 characters. The value is truncated if it exceeds this length. |
Manually trigger memory analysis
The Memory Analysis SDK uses internal policies to determine when to trigger memory analysis. You can call the trigger API to manually trigger memory analysis based on your business attributes.
Memory analysis is triggered only once during each app lifecycle. If memory analysis has already been triggered in a lifecycle, calling the manual trigger API does not trigger another analysis.
triggerMemAnalysis
Triggers memory analysis.
API definition
void triggerMemAnalysis()
Class
ApmMemMonitor