Invoke

This page covers how to change the user-initiated action that invokes the Shake SDK.

Invoke manually

By default, the SDK is invoked when a user shakes their device. You don't need to code anything.

You can choose another action — or more than one — that invokes the SDK.

Let's look at an example. You want your users to invoke SDK either when they shake their device, or when they take a screenshot. To do that, set true or false for certain Shake.configuration properties:

Shake.configuration.isInvokedByShakeDeviceEvent = true
Shake.configuration.isInvokedByScreenshot = true
Shake.start()

This method also enables you to change the preferred invocation event on-the-go during runtime. Here’s a list of all available ones below, feel free to use any combination of these.

Shake.configuration.isInvokedByShakeDeviceEvent = true
Shake.configuration.isFloatingReportButtonShown = true
Shake.configuration.isInvokedByScreenshot = true

Shaking

The default, shaking gesture causes the SDK to pop up.

Button

This invocation event will create the floating button on top of your app's UI which users can clearly see at all times.This button can be dragged to a more suitable position.

Taking a screenshot

The SDK will be invoked when users make a screenshot while using your app.

Invoke through code

You can invoke SDK through code by calling the Shake.show() method anywhere after Shake.start(), optionally adding bug description or attaching files. Here’s an example:

// Shows bug report window
Shake.show(reportData: reportData)
let reportData = ShakeReportData(bugDescription: "Broken UI", attachedFiles: [])
// Shows bug report window with pre-populated data
Shake.show(reportData: reportData)

All other data, like Activity history or Black box, is automatically included in every user’s bug report — no additional code required.