Flashduty Android RUM SDK supports Android 6.0 (API level 23) and above.
By integrating the SDK, you can monitor your Android app’s performance,
errors, and user behavior in real-time.
About Dependencies and Package NamesFlashduty Android SDK is fully compatible with the Datadog open-source protocol. In
build.gradle, use cloud.flashcat group for dependencies, but in Kotlin/Java code, import classes from the com.datadog.android package. You can seamlessly leverage Datadog ecosystem documentation, examples, and best practices while enjoying Flashduty platform services.Integration Steps
Add SDK Dependencies
Add SDK dependencies in your app module’s
build.gradle file:build.gradle
WorkManager is also a
compileOnly dependency, but it is optional. If WorkManager is missing, the SDK logs a warning and disables background upload scheduling; foreground batch uploads continue to work. Add androidx.work:work-runtime explicitly when you want the SDK to keep scheduling uploads after the app moves to the background.Get Application Credentials
In the Flashduty console’s RUM Application Management page:
- Create or select an Android application
- Get the following credentials:
- Application ID - Application unique identifier
- Client Token - Client access token
Initialize SDK
Initialize Flashcat SDK in your
Application class’s onCreate() method:Application.kt
Parameter Description:
environmentName- Environment name (e.g., production, staging)appVariantName- App variant name, used to distinguish data from different build versions- For more configuration options, see Advanced Configuration
Enable RUM Features
Configure and enable Android SDK’s RUM features:
Application.kt
The SDK will automatically start collecting the following data:
- User interaction events
- Long task monitoring
- Activity view tracking
Configure Network Tracking (Optional)
Configure network interceptors to track HTTP requests and responses:Add OkHttp dependency:Configure interceptor:Track Network Redirects or Retries:To monitor network redirects or retries, use Filter Specific Errors:To filter specific errors reported by
Enable distributed Trace tracking
If you only need request URL, method, status code, and error details in RUM,
configuring the OkHttp interceptor is enough. To correlate mobile requests
with backend traces, also add the Trace module and enable
Trace.enable(...).build.gradle
dd-sdk-android-okhttp records OkHttp requests as RUM Resources. dd-sdk-android-trace enables the Trace feature, creates spans, and injects trace headers into first-party requests. Dependencies use the cloud.flashcat group, while Kotlin/Java imports still use the com.datadog.android.* package.Enable Trace:Enable Trace after Datadog.initialize(...) and before sending network requests:Application.kt
Trace.enable(...) is required to enable the Trace feature. GlobalDatadogTracer
registers a global tracer so OkHttp, coroutine integrations, and manual spans
can share the same trace configuration. If only OkHttp automatic tracking is
used, the SDK can create a local tracer when no global tracer is registered,
but explicit registration is recommended so you can set the service name and
simplify troubleshooting.With
DatadogInterceptor, every request handled by OkHttpClient is
automatically recorded as a RUM Resource when it targets a first-party host.
When sampled, the SDK also injects trace headers such as x-datadog-* and
traceparent / tracestate to correlate the request with backend traces.- Hosts must be host names only, without
http://,https://, or path. Configuringexample.comalso matches subdomains such asapi.example.com. - Only network requests initiated while a view is active are tracked. To track requests when the app is in background, see Track Background Events.
- If using multiple interceptors, add
DatadogInterceptoras the first interceptor. Later interceptors that rebuild theRequestmust preserve existing headers.
DatadogInterceptor as a network interceptor:DatadogInterceptor, configure a custom EventMapper in RumConfiguration:Advanced Configuration
Track Background Events
You can track events when the app is running in the background (e.g., crashes and network requests):Offline Data Handling
The Android SDK ensures data availability when the user’s device is offline:Data Persistence Mechanism: - Events are stored locally in batches when
network signal is weak or device battery is low - Automatically uploaded when
network recovers, ensuring no data loss - Old data is automatically cleaned up
to avoid excessive disk usage
Even if users use the app while offline, data is retained and uploaded when
network recovers, ensuring no monitoring data is lost.
Track Local Resource Access
You can track access to assets and raw resources:- Assets Resources
- Raw Resources
WebView Integration
If your Android app contains WebViews, you can enable WebView tracking to monitor web content performance and errors.Web pages in WebView can now be correlated with native app RUM data.
Verify Integration
After integration, verify that the integration is successful:Access Console
Log in to Flashduty console, go to the corresponding RUM application, and check if data is being reported.
Trigger Test Events
Perform the following actions in the app to verify data collection: - Open
different pages in the app to verify page view events - Perform user actions
(clicks, swipes, etc.) to verify interaction events - Trigger network requests
to verify resource loading events
ProGuard Configuration
If your app has code obfuscation enabled (ProGuard/R8), add the following rules to yourproguard-rules.pro file:
proguard-rules.pro
Since 0.4.1, the SDK ships its own obfuscation rules through AAR consumer rules. These rules keep
SourceFile, LineNumberTable, the SDK’s shaded dependencies, and the Gson / OkHttp classes checked by reflection during initialization. You do not need to add Gson / OkHttp keep rules for the SDK yourself. The rule above only keeps the SDK’s public classes. If you serialize your own models with Gson, you still need keep rules for your own model classes, as usual with Gson.Next Steps
Advanced Configuration
Configure advanced SDK features like custom sampling, user identification, global context, etc.
Data Collection
Learn about data types and data structures collected by the SDK
Insights
View and analyze app performance, errors, and user behavior data
Error Tracking
Configure crash reporting and error tracking features