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 normal 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 InstabugInvocationEvent enum when starting the SDK. Initializing Instabug in your application could be done using one or multiple invocation events.

new Instabug.Builder(this, "APP_TOKEN")
	.setInvocationEvents(InstabugInvocationEvent.SHAKE, InstabugInvocationEvent.SCREENSHOT)
	.build();

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.

NONE
SHAKE
FLOATING_BUTTON
SCREENSHOT_GESTURE
TWO_FINGER_SWIPE_LEFT

Changing The Invocation Event

You can change the invocation event to any of the supported events at runtime‚Äč as shown below.

BugReporting.setInvocationEvents(InstabugInvocationEvent.SHAKE, InstabugInvocationEvent.SCREENSHOT)

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 default value is 350. The higher the value the less sensitive the device will be to shaking.

BugReporting.setShakingThreshold(5);

Manual Invocation

If you want to invoke the SDK manually, use the invoke method.

BugReporting.invoke();

Alternatively, instead of showing the menu that lets the users choose what they want to do as shown in the image below, you could show the SDK with a specific feature. In this case, the "How can we help you?" popup shown below will not appear.

Invocation Modes

Invocation Modes

BugReporting.invoke(InvocationMode,InvocationOption)
  // You can also specify invocation options 
EMAIL_FIELD_HIDDEN
EMAIL_FIELD_OPTIONAL
COMMENT_FIELD_REQUIRED
DISABLE_POST_SENDING_DIALOG

Here are the possible invocation modes.

PROMPT_OPTION
NEW_BUG
NEW_FEEDBACK
NEW_CHAT
CHATS_LIST