Invocation

This section covers how to change the event done by the user to invoke the SDK, as well as the default feature to be used once the SDK is invoked.

By default, Instabug is invoked when the device is shaken. This can be customized to several other out-of-the-box modes to show the SDK. You can also show the SDK manually from a custom gesture or a button you add to your app.

Invocation Events

You can set the SDK to be shown using one of the following modes:

  • Shake device
  • Take a screenshot
  • Tap on a floating button shown above your app's UI
  • Do a 2-finger swipe from right to left

To customize the invocation event, pass one of the values of the Instabug.invocationEvent enum when starting the SDK.

//iOS
IBGBugReporting.InvocationEvents = IBGInvocationEvent.FloatingButton | IBGInvocationEvent.Screenshot;

//Android 
new Instabug.Builder(this, "ANDROID_APP_TOKEN")
            .SetInvocationEvent(InstabugInvocationEvent.FloatingButton, InstabugInvocationEvent.Shake)
						.Build();

Here are the possible invocation events. You can find the possible invocation events below. The None event can be used in case you want to prevent the SDK from being invoked by the normal way and invoke it later on manually whenever you need or under certain conditions. In case you are using the floating button, you can set its default position as explained here.

//iOS
IBGInvocationEvent.None
IBGInvocationEvent.Shake
IBGInvocationEvent.Screenshot
IBGInvocationEvent.TwoFingersSwipeLeft
IBGInvocationEvent.RightEdgePan
IBGInvocationEvent.FloatingButton

//Android 
InstabugInvocationEvent.Shake
InstabugInvocationEvent.FloatingButton
InstabugInvocationEvent.ScreenshotGesture
InstabugInvocationEvent.TwoFingerSwipeLeft
InstabugInvocationEvent.None

You can also invoke the event manually as follows.

//iOS
IBGBugReporting.Invoke();

//Android 
BugReporting.Invoke();

Shaking Threshold

If you are using the shaking gesture as your invocation event you can set how sensitive your device is to the shaking. The values in the following iOS example are the default ones. In the case of Android, the default value depends on the device used. The higher the value the less sensitive the device will be to shaking.

//iOS
IBGBugReporting.ShakingThresholdForiPhone = 3.0;
IBGBugReporting.ShakingThresholdForiPad = 1.0;

//Android
BugReporting.SetShakingThreshold(5);

Invocation Mode

Normally when the SDK is invoked the users are shown a window from which they can select what exactly they want to do.

Alternatively, you could show the SDK with a specific feature and option.

IBGBugReporting.InvokeWithInvocationMode(IBGInvocationMode.NewBug, IBGBugReportingInvocationOption.EmailFieldHidden);

Here are the possible modes.

//iOS
IBGInvocationMode.NA
IBGInvocationMode.NewBug
IBGInvocationMode.NewFeedback
IBGInvocationMode.NewChat
IBGInvocationMode.ChatsList

//Android 
IBGInvocationMode.IBGInvocationModeFeedbackSender
IBGInvocationMode.IBGInvocationModeBugReporter
IBGInvocationMode.IBGInvocationModeNA

Below are also all the possible options.

//Hide email
IBGBugReportingInvocationOption.EmailFieldHidden
//Show email as optional
IBGBugReportingInvocationOption.EmailFieldOptional
//Make comment required
IBGBugReportingInvocationOption.CommentFieldRequired