Skip to content

Android bug report attachments

A bug report often needs app state that a screenshot and the activity log cannot show, such as a compact database export, generated diagnostic JSON or a relevant cache entry. AppeliumFeedback for Android lets you attach one application-specific file to every bug report through a BugReportingDelegate. Attachments are supported for bug reports only, not for crash or error reports.

The delegate is called when bug reporting is invoked, and for every silent invocation. Returning null sends the report without an attachment.

Configure the delegate

Pass a BugReportingDelegate to the bug reporting configuration, for example in your Application class:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import com.appelium.feedback.protocols.BugReportingDelegate

AppeliumFeedback.start(
    apiKey = <#api key#>,
    application = this,
    bugReporting = BugReportingConfiguration.Enabled(
        delegate = object : BugReportingDelegate {
            override suspend fun bugReportAttachment(): ReportAttachment? {
                val data = withContext(Dispatchers.IO) { loadDiagnosticSnapshot() } ?: return null
                return ReportAttachment(fileName = "diagnostics.json", data = data)
            }
        }
    )
)

bugReportAttachment() is a suspending function that the SDK calls on the main thread when bug reporting is invoked. Move slower work, such as reading a file, to a background dispatcher. The form opens without waiting for it, and the report is sent once it returns. If it throws, the report is sent without an attachment.

Note

Each bug report carries one attachment. If its data is larger than 100,000 bytes, only the last 100,000 bytes are sent. The attachment keeps its own copy of them, so changing your array afterwards does not change it, and data returns a copy. An attachment without a file name or data is not sent.

Privacy

Attachments are uploaded with the bug report. Review their content as carefully as the report itself:

  • do not attach passwords, access or refresh tokens, private keys, payment-card data or full user profiles;
  • use IDs and state transitions when raw names or email addresses are unnecessary;
  • account for attachment data in the application privacy policy and the workspace retention setting.

The attachment appears on the bug report in the Appelium Dashboard, where it can be downloaded.