Skip to main content

Custom data (7.x Beta)

7.x Beta

This page documents the Bugsee Android SDK 7.x (beta). APIs and behavior may change before general availability. For the stable 6.x documentation, see Adding custom data.

In addition to the data that Bugsee captures automatically, you can enrich reports with your own signals: custom events, time-series traces, user/session attributes, a stable user identifier, and manually-logged unhandled exceptions. These APIs live on the Bugsee facade and are safe to call before or after Bugsee.launch(...) — calls made before launch are buffered.

For automatic log capture and the manual Bugsee.log(...) API, see Logs. For automatic crash reporting, see Crashes.

Custom events

Events are identified by a string and can optionally carry a HashMap of parameters. They are attached to the report and indexed on the Bugsee dashboard.

// Without any additional parameters
Bugsee.event("payment_processed");

// ...or with additional custom parameters
HashMap<String, Object> params = new HashMap<>();
params.put("amount", 125);
params.put("currency", "USD");
Bugsee.event("event with params", params);

Custom traces

Traces are useful when you want to track how a specific variable or state changes over time right before a problem occurs. Each call records a new value for the given trace name; the value can be a number, string, or boolean.

// Number value
Bugsee.trace("credit_balance", 15);

// String value
Bugsee.trace("current_location", "USA");

// Boolean value
Bugsee.trace("logged_in", true);

User and session attributes

Arbitrary key/value attributes can be attached to the report. Issues are searchable by these attributes in the Bugsee dashboard. Attributes persist across sessions until the application is uninstalled or the SDK's storage is cleared.

warning

Each attribute has a limit of 1 kB and the total size of all attributes must not exceed 25 kB.

Bugsee.setAttribute("name", "John Doe");
Bugsee.setAttribute("age", 23);
Bugsee.setAttribute("married", false);

Attributes can be removed individually or all at once:

// Clear a single attribute by name
Bugsee.clearAttribute("name");

// ...or clear all of them
Bugsee.clearAllAttributes();

User identity

New in 7.x

7.x introduces a dedicated user identity API. It replaces the 6.x Bugsee.setEmail(...) / Bugsee.getEmail() pair, which has been removed.

The user identifier is a stable string (such as your backend user ID, an email, or a UUID) that correlates every session and issue for a given user. It is distinct from arbitrary attributes: the identifier is a first-class field on every report and is surfaced prominently in the Bugsee dashboard. Use attributes for additional facts about the user or session; use the identifier for who the user is.

// Set the identifier once the user has signed in
Bugsee.setUserIdentifier("user-123");

// Read back the currently-set identifier (null if none)
String currentId = Bugsee.getUserIdentifier();

// Clear on sign-out
Bugsee.clearUserIdentifier();

Logging unhandled exceptions

New in 7.x

Bugsee.logUnhandledException(Throwable) is new in 7.x. The existing Bugsee.logException(...) API is preserved for non-terminal, handled errors.

logUnhandledException(Throwable) is a fire-and-forget entry point for reporting a Throwable that your app treats as an unhandled crash but which Bugsee's automatic crash handler did not see — for example, when you integrate with a third-party crash reporter that intercepts Thread.UncaughtExceptionHandler before Bugsee, or when you rethrow a background-thread failure onto a crash pipeline of your own.

try {
runCriticalTask();
} catch (Throwable thrown) {
Bugsee.logUnhandledException(thrown);
throw thrown;
}

For handled exceptions that should be recorded as non-terminal errors (and optionally customized with type, severity, or extra parameters), keep using Bugsee.logException(...) instead. Automatic crash and ANR capture does not require either API — see Crashes for details.