Skip to main content
This page describes core configuration, RUM configuration, privacy controls, Trace correlation, crash reporting, and symbol upload for the HarmonyOS SDK. All options come from the current ArkTS SDK public API.

Core configuration

Create core configuration with ConfigurationBuilder and pass it to Flashcat.initialize().
Flashcat.initialize() initializes a given instance name only once. A duplicate call returns the existing instance and does not re-register feature modules.
Pass TrackingConsent during initialization. You can also update it at runtime with Flashcat.setTrackingConsent().
Trace headers also honor tracking consent. The SDK injects correlatable traceparent and tracestate headers only when consent is GRANTED.

RUM configuration

Create RUM configuration with RumConfigurationBuilder and pass it to FlashcatRum.enable().

Event mapping and redaction

Use setEventMapper() to perform lightweight processing before events are reported. Return the modified event to keep it, or null to drop it.
The event mapper runs on the SDK write path. Keep it fast, synchronous, and non-throwing. The SDK catches mapper errors and preserves the original event, but expensive logic increases client overhead.

Global attributes and user information

Global attributes are merged into the context object on subsequent events.
Set user information through the core instance. id, name, and email are written to the usr object on subsequent events.
setUserInfo() currently sets only id, name, and email. The server does not accept other user fields; use RUM global attributes or per-event attributes to write business dimensions to context.

Trace configuration

The Trace module generates W3C traceparent and tracestate, then correlates the generated trace id and span id to RUM resources through _dd.trace_id and _dd.span_id. tracestate carries the Datadog vendor entry dd=s:{0|1};o:rum.
setFirstPartyHosts() is currently used only by the FlashcatHttp wrapper. The rcp interceptor itself is an explicit per-session opt-in, so requests made through a session with the interceptor receive Trace headers. If a request already has traceparent, the SDK does not overwrite the existing Trace context. Existing tracestate keeps other vendors and moves the updated dd= member to the front.

Crash reporting configuration

The Crash module listens to HarmonyOS hiAppEvent for APP_CRASH and APP_FREEZE. The system replays fault events on the next launch, and the SDK reports them through the RUM error pipeline.
Enable Crash after Flashcat.initialize() and FlashcatRum.enable(), and do it early. Crash events are written through the RUM feature. If RUM is not enabled, the Crash module drops received crash replays.

Background and deferred upload

By default, the SDK uploads on the foreground cadence configured by setBatchUploadFrequencyMs() and triggers flush() when the application backgrounds. If you want HarmonyOS WorkScheduler to wake the app for uploads, register deferred upload work.
The SDK registers the WorkScheduler task. When your WorkSchedulerExtensionAbility wakes, call Flashcat.flushAndWait() to perform a bounded batch drain.

Upload HarmonyOS crash symbols

To de-obfuscate ArkTS stacks and symbolicate native .so stacks in the console, upload build artifacts with @flashcatcloud/hvigor-plugin. The plugin uploads two artifact types: The plugin ships as an npm package (on npm, not ohpm); install it as a build-time dev dependency in your project’s root package.json, not in oh-package.json5:
Then register the plugin in the module’s hvigorfile.ts:
hvigorfile.ts
flashcatSymbolUploadPlugin() also accepts two optional fields: buildDir (build output directory, default build/default) and pluginVersion (the version sent in the DD-EVP-ORIGIN-VERSION upload header, default 0.1.0). Neither is normally required.
Run the upload task after a release build:
The plugin sends multipart/form-data to {endpoint}/sourcemap/upload: Upload event types:
Native symbolication depends on the GNU build-id in each .so. The HarmonyOS NDK generates build-id by default. If your build pipeline disables it, add -Wl,--build-id for the .so.