source: "harmony" identifying the data source.
The current SDK module version is
0.1.3. The examples use @flashcatcloud/core, @flashcatcloud/rum, @flashcatcloud/trace, and @flashcatcloud/crash.Prerequisites
Before integrating the SDK, complete these steps:- Create or select a RUM application in the Flashduty console, then obtain the Application ID and Client Token
- Make sure your application can reach
https://browser.flashcat.cloud/api/v2/rum - Declare the
ohos.permission.INTERNETpermission in the host application so the SDK can upload event batches - Use a HarmonyOS NEXT / Stage model project and initialize the SDK early in application startup
Install the SDK
Add the Flashduty modules you need to the application module’soh-package.json5. For RUM only, add at least core and rum; add the Trace and Crash modules when you need network trace correlation or crash reporting.
oh-package.json5
Initialize the SDK
Initialize the SDK inAbilityStage.onCreate when possible. This registers the core instance, RUM, Trace, and Crash before pages, network requests, or exceptions happen.
MyAbilityStage.ets
Track views
If your application uses ArkUIrouter, start automatic view tracking after you obtain a UIContext. This only takes effect when RUM is configured with setTrackNavigation(true).
pages/Index.ets
routerPageUpdate:
| Page state | SDK behavior |
|---|---|
ON_PAGE_SHOW | Generates startView; the view name prefers the route name and falls back to the final path segment |
ON_PAGE_HIDE | Generates stopView; closes the current view and refreshes its duration |
router, use the manual API to manage views.
Track user actions
After enablingsetTrackUserInteractions(true), call FlashcatRum.trackTap() from your button handler or shared click wrapper. The SDK does not automatically traverse all components.
GlobalRumMonitor to record instantaneous or timed actions.
Track network requests and Trace
The HarmonyOS SDK supports two network integration paths.rcp interceptor
If your application usesrcp from @kit.RemoteCommunicationKit, add FlashcatTrace.interceptor() to the session. The interceptor injects W3C traceparent and tracestate, and sends request lifecycle events to RUM so they become resource events.
FlashcatHttp wrapper
If your application uses@kit.NetworkKit, use FlashcatHttp.request() instead of http.createHttp().request(...). The wrapper generates a RUM resource or network error when the request completes or fails.
traceparent and tracestate are injected only when tracking consent is TrackingConsent.GRANTED. FlashcatHttp also honors setFirstPartyHosts(); when no first-party host is configured, it injects into all hosts. If a request already has traceparent, the SDK does not overwrite the existing Trace context.FlashcatTrace.getHeaders() to get traceparent and tracestate headers for manual injection.
Identify users
After sign-in, set the current user. The SDK writes these fields to theusr object on subsequent RUM events.
Verify the integration
After integration, verify it with these steps:- Temporarily enable
setVerbose(true)and inspect HiLog entries with theFlashcattag - Open the application and trigger page navigation, button taps, network requests, or a manual error
- In the Flashduty RUM application, filter for
source:harmonyand confirm view, action, resource, or error events - For network requests, confirm your backend Trace receives
traceparent - After triggering Crash, restart the application; HarmonyOS replays crash events on the next launch
Next steps
Advanced configuration
Configure sampling, tracking consent, event mapping, Trace, and crash symbol upload.
Compatibility
Review supported HarmonyOS projects, Kits, permissions, and current limits.
Data collection
Review event types, fields, and upload behavior collected automatically or manually by the SDK.