User email

When you already have your users identified within your app, you might want to add their email automatically attached to the bug report. Bugsee provides APIs for setting, getting and clearing the email.

// setting email
Bugsee.setEmail("name@example.com");

// getting email, null will be returned if email was not set.
String email = Bugsee.getEmail();

// clearing email
Bugsee.setEmail(null);

User/Session attributes

Besides email, any arbitrary attributes can be attached to the report as well. Issues are searchable by these attributes in the Bugsee dashboard as well.

Note, that each attribute has a limit of 1kB and total size of all attributes must not be more than 25kB
Bugsee.setAttribute("name", "John Doe");
Bugsee.setAttribute("age", 23);
Bugsee.setAttribute("married", false);

Once set, attributes persist until the application is uninstalled from the device. They can be cleared however using the following API.

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

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

Custom traces

Traces may be useful when you want to trace how a specific variable or state changes over time right before the problem happens.

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

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

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

Custom events

Events are identified by a string and can have an optional dictionary of parameters that will be stored and passed along with the report.

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

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

File attachments

File attachments can also be added to the report right before it is sent out. The attachment will be available for download right from the issue viewer. Currently both the amount of attachments and their size is limited. Max of 3 attachments, 1M each.

You should set your implementation of ReportAttachmentsProvider interface to Bugsee using Bugsee.setReportAttachmentsProvider() method. It is recommended to call this method before Bugsee.launch(), because during Bugsee.launch() method execution will start to send reports created earlier. You can attach files, strings and byte arrays using CustomAttachment.fromDataFilePath(), CustomAttachment.fromDataString(), CustomAttachment.fromDataBytes(), accordingly.

Bugsee.setReportAttachmentsProvider(new ReportAttachmentsProvider() {
    @Override
    public ArrayList<CustomAttachment> getAttachments(Report report) {
        ArrayList<CustomAttachment> resultList = new ArrayList<>();

        // If it is a Blocker or crash.
        if (report.getType() == Report.Type.Crash || report.getSeverity() == IssueSeverity.Blocker) {
            // myFilePath is a path to file, which should be attached to the report. 
            CustomAttachment attachment = CustomAttachment.fromDataFilePath(myFilePath);
            attachment.setFileName("detailed_info.txt");
            attachment.setName("Detailed Info");
            resultList.add(attachment);
        }
        return resultList;
    }
});