Quick Start¶
This document provides the shortest integration path for the Android RUM SDK to help you complete a verifiable data upload with minimal steps.
The application supports Agent automatic integration and manual integration. The following steps describe the minimum configuration for manual integration.
Prerequisites¶
Before you begin, complete the following preparations:
- Create an Android app in Real User Monitoring (RUM) and obtain the
RUM App ID. - Confirm the reporting endpoint and authentication method:
- Local environment deployment: Prepare
datakitUrl. - Public DataWay: Prepare
datawayUrlandclientToken.
- Local environment deployment: Prepare
- Confirm that the app already has an
Applicationclass, or create one and declare it inAndroidManifest.xml.
Integration Steps¶
- Configure the Maven repository and add
ft-sdk. - Add
ft-plugin,ft-native, andokhttpas needed. - Install the SDK and initialize
RUMinApplication.onCreate(), and enable crash and UI block detection. - If you need Log Collection or Distributed Tracing, initialize
LogandTrace. - Enable debug logs and trigger a page view or network request to confirm that data is reported successfully.
Maven Repository¶
If you integrate both ft-plugin and ft-sdk, you need to configure Maven repositories separately for the plugin and the AAR dependency. For details about the Gradle configuration, refer to App Access.
Minimal Dependencies¶
// build.gradle
plugins {
id 'com.cloudcare.ft.mobile.sdk.tracker.plugin' version '[latest_version]'
}
// app/build.gradle
dependencies {
implementation 'com.cloudcare.ft.mobile.sdk.tracker.agent:ft-sdk:[latest_version]'
// JSON serialization
implementation 'com.google.code.gson:gson:2.8.+'
// Optional. Required for automatic collection of network requests and automatic tracing. Minimum compatible version: 3.12.+.
implementation 'com.squareup.okhttp3:okhttp:4.+'
}
To use the following capabilities, add the corresponding dependencies:
ft-native: Collect native crashes.okhttp: Required for automatic collection of network requests or automatic injection of Trace Header.
ft-pluginis used to automatically collect data such as page views, clicks, OkHttp requests, and WebView events. If the current project uses an older version of AGP, useft-plugin-legacyinstead. For the complete syntax, refer to App Access.
Application Declaration¶
If the project does not yet have a custom Application, create one first and declare it in AndroidManifest.xml:
Minimal Initialization Example¶
public class DemoApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// For local environment deployment, use FTSDKConfig.builder(datakitUrl)
FTSDKConfig config = FTSDKConfig.builder(datawayUrl, clientToken);
config.setDebug(true);
FTSdk.install(config);
FTSdk.initRUMWithConfig(
new FTRUMConfig()
.setRumAppId(RUM_APP_ID)
.setEnableTraceUserView(true)
.setEnableTraceUserAction(true)
.setEnableTraceUserResource(true)
.setEnableTrackAppUIBlock(true)
.setEnableTrackAppCrash(true)
.setEnableTrackAppANR(true)
);
}
}
class DemoApplication : Application() {
override fun onCreate() {
super.onCreate()
// For local environment deployment, use FTSDKConfig.builder(datakitUrl)
val config = FTSDKConfig.builder(datawayUrl, clientToken)
config.setDebug(true)
FTSdk.install(config)
FTSdk.initRUMWithConfig(
FTRUMConfig()
.setRumAppId(RUM_APP_ID)
.setEnableTraceUserView(true)
.setEnableTraceUserAction(true)
.setEnableTraceUserResource(true)
.setEnableTrackAppUIBlock(true)
.setEnableTrackAppCrash(true)
.setEnableTrackAppANR(true)
)
}
}
The above example meets the minimum RUM integration requirements and enables crash and UI block detection by default. If you use a local environment deployment, replace
FTSDKConfig.builder(datawayUrl, clientToken)withFTSDKConfig.builder(datakitUrl).
Optional: Initialize Log and Trace¶
If you also need Log Collection or Distributed Tracing, you can add the following initialization:
FTSdk.initLogWithConfig(
FTLoggerConfig()
.setEnableCustomLog(true)
.setEnableLinkRUMData(true)
)
FTSdk.initTraceWithConfig(
FTTraceConfig()
.setEnableAutoTrace(true)
.setEnableLinkRUMData(true)
)
Verify the Integration¶
- Keep
config.setDebug(true)enabled and run the application. - Open a page, or initiate a network request in a scenario where
okhttphas been integrated. - Search for
[FT-SDK]inLogcatand confirm that logs such asinitRUMWithConfig completeorSync Successappear. - Return to the Guance console and confirm that the corresponding RUM data appears in the app.
Next Steps¶
- For complete installation and initialization instructions, see App Access.
- For descriptions of all initialization parameters, see SDK Initialization.
- For detailed configuration of RUM, Log, and Trace, see RUM Configuration, Log Configuration, and Trace Configuration.
- If you need to integrate WebView Monitoring, see WebView Monitoring.
- If you need to integrate Session Replay, see Android Session Replay.