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.
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
:
- Java
- Kotlin
OkHttpClient okHttpClient = new OkHttpClient().newBuilder().addInterceptor(new ShakeNetworkInterceptor()).build();
val okHttpClient = OkHttpClient().newBuilder().addInterceptor(ShakeNetworkInterceptor()).build()
If you don’t use OkHttpClient, use this method to forward requests to Shake:
- Java
- Kotlin
Shake.handleNetworkRequest(HttpURLConnection connection,String requestBody,String responseBody);
Shake.handleNetworkRequest(connection: HttpURLConnection,requestBody: String,responseBody: String)
You can log your own custom network requests too:
- Java
- Kotlin
NetworkRequestBuilder networkRequestBuilder = new NetworkRequestBuilder().setUrl("https://api.github.com").setMethod("POST").setRequestHeaders(requestHeaders).setRequestBody(requestBody).setTimestamp(new Date());Shake.insertNetworkRequest(networkRequestBuilder);
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.
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:
<serviceandroid: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:
- Java
- Kotlin
startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"));
startActivity(Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"))
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:
- Java
- Kotlin
Shake.insertNotificationEvent(String notificationTitle,String notificationDescription);
Shake.insertNotificationEvent(notificationTitle: String,notificationDescription: String)
Custom logs
You can add your own logs to Activity history too:
- Java
- Kotlin
Shake.log(LogLevel.INFO, "Log message goes here!");
Shake.log(LogLevel.INFO, "Log message goes here!")
You have these log levels at your disposal:
- Java
- Kotlin
LogLevel.VERBOSELogLevel.DEBUGLogLevel.INFOLogLevel.WARNLogLevel.ERROR
LogLevel.VERBOSELogLevel.DEBUGLogLevel.INFOLogLevel.WARNLogLevel.ERROR
Console logs
Console logs are recorded automatically and require no additional setup. If you want to disable this feature use the method below:
- Java
- Kotlin
Shake.getReportConfiguration().setConsoleLogsEnabled(false);
Shake.getReportConfiguration().isConsoleLogsEnabled = false
Disable
Activity history is enabled by default, use the method below to disable it altogether:
- Java
- Kotlin
Shake.getReportConfiguration().setEnableActivityHistory(false);
Shake.getReportConfiguration().isEnableActivityHistory = false