Privacy and report fields
note
Looking for the previous SDK? See the 6.x report privacy page.
A single ReportHandler lets you inspect or rewrite reports before they are
uploaded. It exposes two callbacks that fire around every report — including
crashes and manual reports:
onBeforeReportCreated(Report, isTerminating, completionCallback)— runs before the report is assembled. Use it to rewrite the summary / description / severity / labels, or to drop sensitive user-entered text.onAfterReportCreated(Report, isTerminating, completionCallback)— runs after assembly. Use it to attach logs, config snapshots, or other extras.
Both callbacks must invoke completionCallback.run() to release the
pipeline — except when isTerminating == true (the process is about to
exit, e.g. unhandled crash), in which case the pipeline continues
regardless.
- Java
- Kotlin
Bugsee.setReportHandler(new ReportHandler() {
@Override
public void onBeforeReportCreated(Report report, boolean isTerminating,
Runnable completionCallback) {
report.setSummary("[" + BuildConfig.FLAVOR + "] " + report.getSummary());
// Scrub anything the user may have typed into the report form:
String desc = report.getDescription();
if (desc != null) {
report.setDescription(desc.replaceAll("\\d{16}", "[CARD]"));
}
report.setSeverity(IssueSeverity.High);
completionCallback.run();
}
@Override
public void onAfterReportCreated(Report report, boolean isTerminating,
Runnable completionCallback) {
// max 3 attachments × 3 MB — write your data via openStream()
Attachment attachment = report.createAndAddAttachment("config")
.setFileName("config.json")
.setMimeType("application/json");
writeConfigSnapshot(attachment);
completionCallback.run();
}
});
Bugsee.setReportHandler(object : ReportHandler {
override fun onBeforeReportCreated(
report: Report,
isTerminating: Boolean,
completionCallback: Runnable
) {
report.summary = "[${BuildConfig.FLAVOR}] ${report.summary}"
report.description = report.description?.replace(Regex("\\d{16}"), "[CARD]")
report.severity = IssueSeverity.High
completionCallback.run()
}
override fun onAfterReportCreated(
report: Report,
isTerminating: Boolean,
completionCallback: Runnable
) {
// max 3 attachments × 3 MB — write your data via openStream()
val attachment = report.createAndAddAttachment("config")
.setFileName("config.json")
.setMimeType("application/json")
writeConfigSnapshot(attachment)
completionCallback.run()
}
})
The previous quota of 3 attachments × 3 MB each is preserved — enforce
it inside your own ReportHandler if needed.
For programmatic report creation see manual reports. For the complete list of listener interfaces see the public API reference.
Found an issue, typo, or wrong statement on this page? Report it now →