Bug Reporting

This page covers some APIs specific for Xamarin bug reporting.

We're covering bug reporting in this page. However, in the Reports Data section, you can find more information about the information and data sent with each bug report.

Required Fields

Email Address

Bug reports and feedback by default require users to enter a valid email address. To allow users to send bug reports and feedback without an email, use the following method.

//iOS
IBGBugReporting.InvocationOptions = IBGBugReportingInvocationOption.EmailFieldOptional;

//Android
BugReporting.SetInvocationOptions(InvocationOption.EmailFieldOptional);

Comment

By default, users could send bug reports and feedback without entering a comment. To require users to enter a comment before they are able to send a bug report or feedback, use the following method.

//iOS
IBGBugReporting.InvocationOptions = IBGBugReportingInvocationOption.CommentFieldRequired;

//Android
BugReporting.SetInvocationOptions(InvocationOption.CommentFieldRequired);

The image below shows the 1st view that your users will see while reporting a bug.

SDK Events

Before Showing the SDK

This block is executed on the UI thread. Could be used for performing any UI changes before the SDK's UI is shown.

//iOS
IBGBugReporting.WillInvokeHandler = () => 
{
  Console.WriteLine("SDK will be invoked!");
};

//Android
Instabug.SetOnSdkInvokedCallback(new IOnSdkInvokedCallbackClass());

private class IOnSdkInvokedCallbackClass : Java.Lang.Object, IOnSdkInvokedCallback
{
  public void OnSdkInvoked()
  {
    Android.Util.Log.Warn("OnSdkInvoked", "Instabug SDK invoked");
  }
}

Before Sending a Report

This block is executed in the background before sending each report. Could be used for attaching logs and extra data to reports.

//iOS
Instabug.WillSendReportHandler = (IBGReport report) =>
{
  report.LogVerbose("Verbos log");
  report.SetUserAttribute("User Attirbute Value", "Key");
  return report;
};

//Android
Instabug.OnReportSubmitHandler(new BeforeSendingReportCallback());

public class BeforeSendingReportCallback : Java.Lang.Object, Report.IOnReportCreatedListener
{
  public void OnReportCreated(Report report)
  {
    report.AddTag("Tag");
    report.LogVerbose("Verbose Log");
    report.AppendToConsoleLogs("Console Log");
    report.SetUserAttribute("User Attribute Value", "Key");
  }
}

After the SDK Has Been Dismissed

This block is executed on the UI thread. Could be used for performing any UI changes after the SDK's UI has been dismissed.

//iOS
IBGBugReporting.DidDismissHandler = (IBGDismissType dismissType, IBGReportType reportType) =>
{
	Console.WriteLine("Dismiss Type: " + dismissType + ". Report Type: " + 		reportType);
};

//Android
//Not supported yet

Disabling and Enabling

Bug reporting, feedback, and chats can be enabled or disabled separately. When the user invokes the SDK with any of the invocation events, a popup appears showing all the enabled features. When only a single option is enabled, it becomes the default invocation mode and the popup doesn't appear. If all options are disabled, bug reporting becomes the default invocation mode.

//iOS
IBGBugReporting.PromptOptions = IBGPromptOption.Bug | IBGPromptOption.Chat;

//Android 
BugReporting.SetPromptOptionsEnabled(PromptOption.Bug, PromptOption.Chat);

By default, all three options are enabled if they are available in your current plan.