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;
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.
- Initial configuration specified by
SetupConfiguration
. - Settings retrieved from the backend.
- Preferred behavior specified via Preferences.
Smartlook.Instance.state;
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:
RecordingStatus status = Smartlook.Instance.state.Status;
enum RecordingStatus {
recording,
not_started,
stopped,
project_limit_reached,
below_min_sdk_version,
storage_limit_reached,
internal_error,
}
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:
Status | Possible Cause |
---|---|
Cause.NOT_STARTED | The recording has not started yet. |
Cause.STOPPED | The recording was stopped using stop() . |
Cause.PROJECT_LIMIT_REACHED | The project limit of recorded sessions has been reached. |
Cause.STORAGE_LIMIT_REACHED | The SDK cannot record because it would violate storage limits. |
Cause.INTERNAL_ERROR | The SDK stopped recording due to an internal error. |
Default value
The default status
is RecordingStatus.not_started
.
Project key
A unique project key is needed for the SDK to upload and process the recordings.
Set the project key
Smartlook.Instance.preferences.ProjectKey = "YOUR PROJECT KEY";
Unique project key
You can find your project key in the mobile project settings on the [Smartlook dashboard](https://app.smartlook.com/.)
Read the project key
String? projectKey = Smartlook.Instance.state.ProjectKey;
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
and10
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;
Read the frame rate
int frameRate = Smartlook.Instance.state.FrameRate;
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:
Rendering mode | What is captured |
---|---|
RenderingMode.NATIVE | Periodically captures the app screen which the SDK immediately processes to remove sensitive data. The frames are then complied to make the session recording. For more information, see Hiding sensitive data. |
RenderingMode.NO_RENDERING | Nothing is recorded. |
Set rendering mode
Smartlook.Instance.preferences.RenderingMode = RenderingMode.Native;
Read rendering mode
RenderingMode renderingMode = Smartlook.Instance.state.RenderingMode;
Default value
The default rendering mode is RenderingMode.NATIVE
.
Surface recording
By default, recording of SurfaceView
and TextureView
is not enabled. You can enable it using surfaceRecordingEnabled
.
Set surface recording
//only for Android
Smartlook.Instance.preferences.SurfaceCaptureEnabled = true;
Read surface recording
//only for Android
bool isSurfaceEnabled = Smartlook.Instance.state.SurfaceCaptureEnabled;
Default value
Surfaces are not recorded by default, 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.AdaptiveFrameRateEnabled = true;
Read adaptive frame rate
bool isAdaptiveFrameRateEnabled = Smartlook.Instance.state.AdaptiveFrameRateEnabled;
Default value
By default, the adaptive frame rate is disabled, thus the default value is false
.
Event tracking
Tracking of some automatically tracked events can be enabled/disabled using event tracking API.
All automatically detected events
Smartlook.Instance.preferences.eventTracking.EnableAll();
Smartlook.Instance.preferences.eventTracking.DisableAll();
User interaction events
All automatically detected user interaction events can be enabled/disabled. Rage clicks and trackUser (selector, clicks) can be tracked individually.
Smartlook.Instance.preferences.eventTracking.interaction.RageClickEnabled = true;
Smartlook.Instance.preferences.eventTracking.interaction.TrackUserInteraction = true;
Default value
By default, all automatically detected events are tracked, except Fragment
navigation events. The default can be restored using the following:
Smartlook.Instance.preferences.eventTracking.RestoreDefault();