Skip to main content

Activity history

Shake tracks user's interaction with your app, their network traffic, notifications, logs and system events, and automatically attaches all of those to the ticket.

Setup

User actions

Shake automatically observes taps made on your app's UI elements.

note

This feature is disabled for apps built with Jetpack Compose.

Network traffic

If you want to receive users' network traffic logs, add this line to your OkHttpClient:

App.kt
val okHttpClient = OkHttpClient()
.newBuilder()
.addInterceptor(ShakeNetworkInterceptor())
.build()

If you don’t use OkHttpClient, use this method to forward requests to Shake:

App.kt
Shake.handleNetworkRequest(
connection: HttpURLConnection,
requestBody: String,
responseBody: String)

You can log your own custom network requests too:

App.kt
val networkRequestBuilder = NetworkRequestBuilder()
.setUrl("https://api.github.com")
.setMethod("POST")
.setRequestHeaders(requestHeaders)
.setRequestBody(requestBody)
.setTimestamp(Date())
Shake.insertNetworkRequest(networkRequestBuilder)

System events

System events - also known as app lifecycle events - are tracked automatically and require no additional setup.

Screen changes

Screen changes are tracked automatically and require no additional setup.

note

The SDK will collect just changes of Android Activities, adding, removing or replacing Fragments inside an Activity is not tracked.

Notifications

In order for Shake to track notifications throughout your app, add ShakeNotificationListenerService to your AndroidManifest file inside application tag:

AndroidManifest.xml
<service
android:name="com.shakebugs.shake.ShakeNotificationListenerService"
android:exported="false"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>

Additionally, app user must manually grant a permission to listen for notifications. You can show notifications permission settings screen using the following method:

App.kt
startActivity(Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"))
note

Keep in mind that notification listener intercepts notifications in your app. This can be a security issue if your notifications contains authorization codes. Make sure that you remove sensitive data using notification filter described on our privacy page.

You can add your own custom notification events at any time:

App.kt
Shake.insertNotificationEvent(
notificationTitle: String,
notificationDescription: String
)

Custom logs

You can add your own logs to Activity history too:

App.kt
Shake.log(LogLevel.INFO, "Log message goes here!")

You have these log levels at your disposal:

App.kt
LogLevel.VERBOSE
LogLevel.DEBUG
LogLevel.INFO
LogLevel.WARN
LogLevel.ERROR

Console logs

Console logs are recorded automatically and require no additional setup. If you want to disable this feature use the method below:

App.kt
Shake.getReportConfiguration().isConsoleLogsEnabled = false

Disable

Activity history is enabled by default, use the method below to disable it altogether:

App.kt
Shake.getReportConfiguration().isEnableActivityHistory = false