Callbacks
Execute a block of a code when a certain action is executed by Shake
Shake open callback
If you want to perform an action when Shake interface is opened, you can do it like shown below:
- Java
- Kotlin
App.java
Shake.getReportConfiguration().setShakeOpenListener(new ShakeOpenListener() {@Overridepublic void onShakeOpen() {Log.i("Shake", "onShakeOpen");}});
App.kt
Shake.getReportConfiguration().shakeOpenListener = object : ShakeOpenListener {override fun onShakeOpen() {Log.i("Shake", "onShakeOpen")}}
Shake dismiss callback
If you want to perform an action when Shake interface is closed, you can do it like shown below:
- Java
- Kotlin
App.java
Shake.getReportConfiguration().setShakeDismissListener(new ShakeDismissListener() {@Overridepublic void onShakeDismiss() {Log.i("Shake", "onShakeDismiss");}});
App.kt
Shake.getReportConfiguration().shakeDismissListener = object : ShakeDismissListener {override fun onShakeDismiss() {Log.i("Shake", "onShakeDismiss")}}
Shake submit callback
To detect when user pressed a submit button on the New ticket screen, add a submit listener like in the example below.
This listener provides type and fields parameters:
- reportType: String - "crash" or "feedback" depending on the type of the ticket
- fields: Map<String, String> - key value pairs of submitted form fields
- Java
- Kotlin
App.java
Shake.getReportConfiguration().setShakeSubmitListener(new ShakeSubmitListener() {@Overridepublic void onShakeSubmit(@NonNull String reportType, @NonNull Map<String, String> fields) {Log.i("Shake", "onShakeSubmit");}});
App.kt
Shake.getReportConfiguration().shakeSubmitListener = object : ShakeSubmitListener {override fun onShakeSubmit(reportType: String, fields: Map<String, String>) {Log.i("Shake", "onShakeSubmit")}}