Quick Start¶
This document provides the shortest path to integrate the Android RUM SDK, helping you complete a verifiable data upload with minimal steps.
Prerequisites¶
Before starting, please complete the following preparations:
- Create an Android application in RUM and obtain the
RUM App ID. - Confirm the upload address and authentication method:
- Local environment deployment: Prepare
datakitUrl. - Public DataWay: Prepare
datawayUrlandclientToken. - Confirm that the application already has an
Application, or prepare to create a new one and declare it inAndroidManifest.xml.
Integration Steps¶
- Configure the Maven repository and introduce
ft-sdk. - Introduce
ft-plugin,ft-native,okhttpas needed. - Install the SDK and initialize
RUMinApplication.onCreate(), while enabling crash and lag detection. - If log collection or distributed tracing is needed, then initialize
LogandTrace. - Enable debug logs and trigger a page view or network request to confirm successful data upload.
Maven Repository¶
If integrating both ft-plugin and ft-sdk, you need to configure Maven repositories for the plugin and AAR dependencies separately. For specific Gradle configuration methods, please refer directly to Application Access.
Minimum 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 if automatic network request collection and automatic trace enabling are needed, minimum compatible version 3.12.+
implementation 'com.squareup.okhttp3:okhttp:4.+'
}
If the following capabilities are needed, please add the corresponding dependencies:
ft-native: For collecting Native Crash.okhttp: Required when automatic network request collection or automatic Trace Header injection is needed.
ft-pluginis used for automatic collection of page views, clicks, OkHttp requests, WebView data, etc. If the current project uses an older version of AGP, please useft-plugin-legacyinstead. For the complete syntax, refer to Application Access.
Application Declaration¶
If your project does not yet have a custom Application, please create one first and declare it in AndroidManifest.xml:
Minimum Initialization Example¶
public class DemoApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Use FTSDKConfig.builder(datakitUrl) for local environment deployment
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()
// Use FTSDKConfig.builder(datakitUrl) for local environment deployment
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 ANR detection by default. If using 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 Integration Success¶
- Keep
config.setDebug(true)enabled and run the application. - Open a page, or initiate a network request in a scenario where
okhttpis integrated. - Search for
[FT-SDK]inLogcatand confirm logs similar toinitRUMWithConfig completeorSync Successappear. - Return to the Guance console and confirm that corresponding RUM data has appeared in the application.
Next Steps¶
- For complete installation and initialization instructions, continue reading Application Access.
- For explanations of all initialization parameters, read SDK Initialization.
- For detailed configurations of RUM, Log, and Trace, read RUM Configuration, Log Configuration, Trace Configuration.
- If WebView monitoring integration is needed, read WebView Monitoring.
- If Session Replay integration is needed, read Android Session Replay.