Invoke
Decide how you want Shake user feedback to be invoked.
Invoke manually
By default, Shake user feedback is invoked when a user shakes their device. You don't need to code anything:
But if you want to, you can customize that.
Let's look at an example where you want Shake user feedback to be invoked either when your users shake their device or when they take a screenshot:
- Objective-C
- Swift
SHKShake.configuration.isInvokedByShakeDeviceEvent = YES;SHKShake.configuration.isInvokedByScreenshot = YES;[SHKShake startWithApiKey:@"app-api-key"];
Shake.configuration.isInvokedByShakeDeviceEvent = trueShake.configuration.isInvokedByScreenshot = trueShake.start(apiKey: "app-api-key")
You can also change the preferred invocation event on-the-fly during runtime. Here’s a list of all available options. Feel free to use any combination of these:
- Objective-C
- Swift
SHKShake.configuration.isInvokedByShakeDeviceEvent = YES;SHKShake.configuration.isFloatingReportButtonShown = YES;SHKShake.configuration.isInvokedByScreenshot = YES;SHKShake.configuration.isInvokedByRightEdgePan = YES;
Shake.configuration.isInvokedByShakeDeviceEvent = trueShake.configuration.isFloatingReportButtonShown = trueShake.configuration.isInvokedByScreenshot = trueShake.configuration.isInvokedByRightEdgePan = true
Also, feel free to change which Shake screen is shown when Shake user feedback is invoked manually:
- New ticket screen (default)
- Home screen
- Chat screen
- Objective-C
- Swift
SHKShake.configuration.defaultShowOption = SHKShowOptionNew;SHKShake.configuration.defaultShowOption = SHKShowOptionHome;SHKShake.configuration.defaultShowOption = SHKShowOptionNewChat;
Shake.configuration.defaultShowOption = .newShake.configuration.defaultShowOption = .homeShake.configuration.defaultShowOption = .newChat
If you are showing Shake chat screen, make sure that you have registered your app user. Otherwise Shake home screen will be shown.
Shaking gesture
By default, the shaking gesture opens Shake user feedback.
The shaking threshold can be fine-tuned too. Let's decrease it, for example, so that Shake user feedback is easier to invoke:
- Objective-C
- Swift
SHKShake.configuration.shakingThreshold = 400; // Default value is 600.
Shake.configuration.shakingThreshold = 400 // Default value is 600.
A valid threshold value range is 1 - 1000
. Higher values represent higher thresholds, meaning that a stronger
motion gesture will be required to invoke Shake user feedback.
Floating button
This invocation event creates a floating button on top of your app's UI which your users will be able to see and drag around the screen at all times.
Taking a screenshot
Shake user feedback will be invoked when your user takes a screenshot while using your app.
App Store rejects apps that get in the way of the default screenshot behavior. For that reason, don't use this invocation method in your production releases.
Right edge pan
Shake user feedback will be invoked with a one-finger swiping gesture from the right edge of the screen.
Invoke through code
Invoke Shake user feedback through code by calling the Shake.show
method anywhere after Shake.start
.
The show
method can also be called with the argument SHKShowOption
which determines the first presented screen in the Shake UI.
- Objective-C
- Swift
[SHKShake show:SHKShowOptionNew];[SHKShake show:SHKShowOptionHome];[SHKShake show:SHKShowOptionNewChat];
Shake.show(.new)Shake.show(.home)Shake.show(.newChat)
If an auto screenshot and auto screen recording are enabled, when you call SHKShowOptionNew they will be automatically attached to a ticket.
If enabled, activity history, black box and all other data are also automatically attached. No additional code is required.
If you are showing Shake chat screen, make sure that you have registered your app user. Otherwise Shake home screen will be shown.