Preferences

Preferences are the settings that are preferred by the user. These preferences could differ from the settings the SDK uses when recording.

Smartlook.instance.preferences
Smartlook.getInstance().getPreferences();

State

Calling state returns the settings that are currently used by the SDK. The state of every SDK setting is based on:

  • Default SDK settings.
  • Settings retrieved from the backend.
  • Preferences specified through the API .
Smartlook.instance.state
Smartlook.getInstance().getState();

Status

Because status is read-only, you can only get it using state. It can be used to check if the SDK is currently recording. It can also provide additional information about why the SDK is not recording. Full usage example:

when(val status = Smartlook.instance.state.status) {
  Status.Recording -> {}
    is Status.NotRecording -> {
    when(status.cause) {
      Status.NotRecording.Cause.NOT_STARTED -> {}
      Status.NotRecording.Cause.STOPPED -> {}
      Status.NotRecording.Cause.PROJECT_LIMIT_REACHED -> {}
      Status.NotRecording.Cause.STORAGE_LIMIT_REACHED -> {}
      Status.NotRecording.Cause.INTERNAL_ERROR -> {}
    }
  }
}
Status status = Smartlook.getInstance().getState().getStatus();

if (status instanceof Status.Recording) {
} else if (status instanceof Status.NotRecording) {
    switch (((Status.NotRecording) status).getCause()) {
        case NOT_STARTED:
            break;
        case STOPPED:
            break;
        case PROJECT_LIMIT_REACHED:
            break;
        case STORAGE_LIMIT_REACHED:
            break;
        case INTERNAL_ERROR:
            break;
    }
}

If the SDK is recording, you get Status.Recording. If the SDK is not recording, you get Status.NotRecording and then possible causes. Causes of Status.NotRecording can be:

StatusPossible Cause
Cause.NOT_STARTEDThe recording has not started yet.
Cause.STOPPEDThe recording was stopped using stop().
Cause.PROJECT_LIMIT_REACHEDThe project limit of recorded sessions has been reached.
Cause.STORAGE_LIMIT_REACHEDThe SDK cannot record because it would violate storage limits.
Cause.INTERNAL_ERRORThe SDK stopped recording due to an internal error.

Default value

The default status is Status.NotRecording with cause Cause.NOT_STARTED.

Project key

A unique project key is needed for the SDK to upload and process recordings.

Set the project key

Smartlook.instance.preferences.projectKey = "YOUR PROJECT KEY"
Smartlook.getInstance().getPreferences().setProjectKey("YOUR PROJECT KEY");

πŸ“˜

Unique project key

You can find your project key in the mobile project settings on the Smartlook dashboard.

Read the project key

val projectKey = Smartlook.instance.preferences.projectKey
String projectKey = Smartlook.getInstance().getPreferences().getProjectKey();

Default value

The project key is not defined by default (set to null).

Frame rate

Set the preferred frame rate recorded by the SDK. Only settings between 2 and 10 frames per second are allowed.

🚧

Frame rate set through API

If you set a frame rate between 2 and 10 frames per second using the API, any settings that are set from the dashboard are ignored.

Set the frame rate

Smartlook.instance.preferences.frameRate = 2
Smartlook.getInstance().getPreferences().setframeRate(2);

Read the frame rate

val frameRate = Smartlook.instance.state.frameRate
int frameRate = Smartlook.getInstance().getState().getFrameRate();

Default value

The default frame rate used by the SDK is 2 frames per second.

Rendering mode

The SDK can use different methods of capturing screen image data. These are called rendering modes.

Several rendering modes are available:

  • RenderingMode.NATIVE – Captures the application as the user sees it. Elements set as View sensitive (read more) are hidden.
  • RenderingMode.WIREFRAME – Symbolic representation of the application that does not expose sensitive data by default.
  • RenderingMode.NO_RENDERING – Nothing is recorded.

Set rendering mode

Smartlook.instance.preferences.renderingMode = RenderingMode.NATIVE
Smartlook.getInstance().getPreferences().setRenderingMode(RenderingMode.NATIVE);

Read rendering mode

val renderingMode = Smartlook.instance.state.renderingMode
RenderingMode renderingMode = Smartlook.getInstance().getState().getRenderingMode();

Default value

The default rendering mode is RenderingMode.NATIVE.

Wireframe rendering mode options

The RenderingMode.WIREFRAME can be further fine-tuned by setting a RenderingModeOption.

Several rendering mode options are available:

  • RenderingMode.WIREFRAME – Captures View colors.
  • RenderingMode.BLUEPRINT – Does not capture View colors (only View outlines).
  • RenderingMode.ICON_BLUEPRINT – Similar to RenderingMode.BLUEPRINT, but adds View type icons for known Views.

Set rendering mode option

Smartlook.instance.preferences.renderingModeOption = RenderingModeOption.WIREFRAME
Smartlook.getInstance().getPreferences().setRenderingModeOption(RenderingModeOption.WIREFRAME);

🚧

Rendering mode options are only used when RenderingMode.WIREFRAME is used by the SDK.

Read rendering mode option

val renderingModeOption = Smartlook.instance.preferences.renderingModeOption
RenderingModeOption renderingModeOption = Smartlook.getInstance().getState().getRenderingModeOption();

Default value

The default rendering mode option is not defined (is null), because the default rendering mode is RenderinMode.NATIVE.

Surface recording

By default, recording of SurfaceView and TextureView is not enabled. You can enable it using surfaceRecordingEnabled`.

Set surface recording

Smartlook.instance.preferences.isSurfaceRecordingEnabled = true
Smartlook.getInstance().getPreferences().setSurfaceRecordingEnabled(true);

Read surface recording

val isSurfaceRecordingEnabled = Smartlook.instance.state.isSurfaceRecordingEnabled
boolean isSurfaceRecordingEnabled = Smartlook.getInstance().getState().isSurfaceRecordingEnabled();

Default value

By default, surfaces are not recorded, thus the default value is set to false.

Adaptive frame rate

To lower requirements on the CPU, storage space, and network bandwidth, the SDK captures the screen only when there is something drawn in the application. This detection works well in typical native applications, but might be problematic when Surface, TextureView, or similar is used. Thus adaptive frame rate can be disabled.

Set adaptive frame rate

Smartlook.instance.preferences.isAdaptiveFrameRateEnabled = true
Smartlook.getInstance().getPreferences().setAdaptiveFrameRateEnabled(true);

Read adaptive frame rate

val isAdaptiveFrameRateEnabled = Smartlook.instance.state.isAdaptiveFrameRateEnabled
boolean isAdaptiveFrameRateEnabled = Smartlook.getInstance().getPreferences().isAdaptiveFrameRateEnabled();

Default value

By default, adaptive frame rate is enabled, thus the default value is true.

Event tracking

Tracking of some automatically tracked events can be enabled or disabled using Event Tracking API.

All automatically detected events

Smartlook.instance.preferences.eventTracking.enableAll()
Smartlook.instance.preferences.eventTracking.disableAll()
Smartlook.getInstance().getPreferences().getEventTracking().enableAll();
Smartlook.getInstance().getPreferences().getEventTracking().disableAll();

Navigation events

All automatically detected navigation events can be enabled or disabled. Or, Activity and Fragment detection can be enabled or disabled separately.

val eventTracking = Smartlook.instance.preferences.eventTracking
  
eventTracking.navigation.enableAll()
eventTracking.navigation.disableAll()
  
eventTracking.navigation.isActivityEnabled = true
eventTracking.navigation.isFragmentEnabled = true
EventTracking eventTracking = Smartlook.getInstance().getPreferences().getEventTracking();
  
eventTracking.getNavigation().enableAll();
eventTracking.getNavigation().disableAll();
  
eventTracking.getNavigation().setActivityEnabled(true);
eventTracking.getNavigation().setFragmentEnabled(true);

πŸ“˜

Fragment navigation event detection is disabled by default.

Instances of Activity and Fragment can be excluded from navigation event detection using the following:

val eventTracking = Smartlook.instance.preferences.eventTracking
  
eventTracking.navigation.disabledActivityClasses += SampleActivity::class
eventTracking.navigation.disabledFragmentClasses += SampleFragment::class
EventTracking eventTracking = Smartlook.getInstance().getPreferences().getEventTracking();
  
eventTracking.getNavigation().getDisabledActivityClasses().add(SampleActivity.class);
eventTracking.getNavigation().getDisabledFragmentClasses().add(SampleFragment.class);

User interaction events

All automatically detected user interaction events can be enabled or disabled. Or, "rage click", "selector", and "touch" event detection can be enabled and disabled separately.

val eventTracking = Smartlook.instance.preferences.eventTracking
  
eventTracking.interaction.enableAll()
eventTracking.interaction.disableAll()
  
eventTracking.interaction.isRageClickEnabled = true
eventTracking.interaction.isSelectorEnabled = true
eventTracking.interaction.isTouchEnabled = true
EventTracking eventTracking = Smartlook.getInstance().getPreferences().getEventTracking();
  
eventTracking.getInteraction().enableAll();
eventTracking.getInteraction().disableAll();
  
eventTracking.getInteraction().setRageClickEnabled(true);
eventTracking.getInteraction().setSelectorEnabled(true);
eventTracking.getInteraction().setTouchEnabled(true);

Default value

By default , all automatically detected events are tracked, except Fragmentnavigation events.
The default can be restored using the following:

Smartlook.instance.preferences.eventTracking.default()
Smartlook.getInstance().getPreferences().getEventTracking().default();