Measure provides a number of configuration options to customize the data collected and the behavior of the SDK. These
options can be set in the MeasureConfig
object which is passed to the Measure.init
method. Example:
Measure.init(
context, MeasureConfig(
enableLogging = true,
trackScreenshotOnCrash = true,
screenshotMaskLevel = if (BuildConfig.DEBUG) {
ScreenshotMaskLevel.SensitiveFieldsOnly
} else {
ScreenshotMaskLevel.AllTextAndMedia
},
trackHttpHeaders = true,
trackHttpBody = true,
trackActivityIntentData = true,
httpUrlBlocklist = listOf("http://localhost:8080"),
httpUrlAllowlist = listOf("http://example.com"),
httpHeadersBlocklist = listOf("X-USER-EMAIL"),
samplingRateForErrorFreeSessions = 0.5f,
autoStart = false,
traceSamplingRate = 0.001f,
)
)
- trackScreenshotOnCrash
- screenshotMaskLevel
- httpUrlBlocklist
- httpUrlAllowlist
- trackHttpHeaders
- httpHeadersBlocklist
- trackHttpBody
- trackActivityIntentData
- samplingRateForErrorFreeSessions
- enableLogging
- eventTrackingLevel
- traceSamplingRate
Whether to capture a screenshot of the app when it crashes due to an unhandled exception or ANR.
Defaults to true
.
Allows changing the masking level of screenshots if trackScreenshotOnCrash
is enabled to prevent sensitive
information from leaking. Defaults to ScreenshotMaskLevel.AllTextAndMedia
.
The following levels of masking can be applied to the screenshots:
Masks all text, buttons, input fields, image views and video.
For View based UI, video masking is performed on VideoView and Exoplayer's androidx.media3.ui.PlayerView
and image masking is performed on ImageView
. Image and video masking is currently not supported for Compose based UI.
Example:
Masks all text, buttons & input fields.
Example:
Masks all text & input fields except clickable views like buttons.
Example:
Masks sensitive input fields like password, email & phone fields.
For View based UI, all input fields
with inputType
set to textPassword
, textVisiblePassword
, textWebPassword
, numberPassword
, textEmailAddress
, textEmail
and phone
are masked in the screenshot.
For compose based UI, all input fields with KeyboardOptions set
to KeyboardOptions(keyboardType = KeyboardType.Password)
are masked in the screenshot by default.
Example:
![]() |
![]() |
If these options do not satisfy your requirements, consider using FLAG_SECURE to hide an entire screen with potential sensitive information from screenshots.
Allows enabling/disabling capturing of HTTP request and response headers. Disabled by default.
Allows specifying HTTP headers which should not be captured. See HTTP headers blocklist
By default, the following headers are always disallowed to prevent sensitive information from leaking:
- Authorization
- Cookie
- Set-Cookie
- Proxy-Authorization
- WWW-Authenticate
- X-Api-Key
Allows enabling/disabling capturing of HTTP request and response body. Disabled by default.
Allows disabling collection of http
events for certain URLs. This is useful to setup if you do not
want to collect data for certain endpoints or third party domains. By default, no URLs are blocked.
Note that this list is used only if httpUrlAllowlist
is empty.
The check is made using [String.contains] to see if the URL contains any of the strings in the list.
Allows enabling collection of http
events only for certain URLs. This is useful to setup if you want
to collect data only for certain endpoints or third party domains. If this list is empty, httpUrlBlocklist
is
considered. By default, this list is empty.
The check is made using [String.contains] to see if the URL contains any of the strings in the list.
Android Intent can contain a bundle with any arbitrary information. While this can be useful to debug certain issues which require checking what data was passed as part of the bundle, it might also contain sensitive information.
trackActivityIntentData
allows enabling/disabling of collection of intent data for the following events:
lifecycle_activity.created
event, which is collected with the Activity lifecycle eventonCreate
is triggered.cold_launch
event, which is collected when the app is launched from a cold start.warm_launch
event, which is collected when the app is launched from a warm start.hot_launch
event, which is collected when the app is launched from a hot start.
Disabled by default.
Controls sampling rate for non-crashed sessions. Defaults to 0.
A value between 0.0 and 1.0 can be set:
- 0.0 (default): Only collect crashed sessions
- 0.1: Collect 10% of non-crashed sessions
- 1.0: Collect all sessions
Note that all crashed sessions are collected regardless of this setting.
Measure SDK collects traces at a sampled rate of 0.1%. Meaning 0.1% of all traces will be sent to the server. To modify
this rate use traceSamplingRate
.
The sampling rate is a value between 0 and 1. For example, a value of 0.1
will export only 10%
of the traces, a value of 0
will disable exporting of traces completely.
Allows enabling/disabling internal logging of Measure SDK. This is useful to debug issues with the SDK itself. By default, logging is disabled.
Controls whether to start tracking immediately or delay starting the SDK.
Defaults to true.
Use Measure.start
to start the SDK at a different point and Measure.stop
to stop the SDK from tracking
data.