Attachments

This section covers how to send different types of attachments with each bug report.

The attachments sent with each bug or crash report can be broken down into 2 categories. The default Instabug attachments and custom extra attachments.

Instabug Attachments

The main attachment sent with any bug report is the screenshot taken when the SDK was invoked. The users can annotate this screenshot. Other additional attachment types can be enabled or disabled
The attachment options are:

  • Extra screenshots.
  • Images from phone gallery.
  • Screen recording.
Attachment - Dashboard

Attachment - Dashboard

By default, All attachment options are enabled if they are available in your current plan.

You can choose attachment options that will be available to the reporter by adding the following method call.

// Arguments:initialScreenshot, extraScreenshot, galleryImage & ScreenRecording
Instabug.setAttachmentTypesEnabled(true, true, false, false);

Each of the parameters is a boolean used to indicate if a certain type is enabled or not.

Extra Attachments

The SDK allows you to attach custom files to reports. You can attach up to 3 files, each up to 5 MB.

Extra Attachment - Dashboard

Extra Attachment - Dashboard

Use the following method to add a new file attachment:

Instabug.addFileAttachment(fileUri, "file_name.txt");

A new copy of the file at fileURI will be attached with each bug report being sent. The file is only copied at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy attached to your bug reports will always contain that latest changes at the time of sending the report.

Each call to this method adds the file to the files attached until a maximum of 3 then it overrides the first file. The file has to be available locally at the provided path when the report is being sent.

To clear list of files to be attached to reports, use the following method:

Instabug.clearFileAttachment();

This method doesn't delete any files from the file system. It will just remove them from the list of files to be attached to each report.