Preferences
Preferences are the settings that are preferred by the user. These preferences can differ from the settings the SDK uses when recording.
Smartlook.instance.preferencesSmartlook.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.stateSmartlook.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:
| 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 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");
Your project keyYou can find your project key in the mobile project settings the Smartlook app.
Read the project key
val projectKey = Smartlook.instance.preferences.projectKeyString 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 APIIf you set a frame rate between
2and10frames per second using the API, any settings that are set from the dashboard are ignored.
Set the frame rate
Smartlook.instance.preferences.frameRate = 2Smartlook.getInstance().getPreferences().setframeRate(2);Read the frame rate
val frameRate = Smartlook.instance.state.frameRateint frameRate = Smartlook.getInstance().getState().getFrameRate();Default value
The default frame rate used by the SDK is 2 frames per second.
Rendering modes
The SDK can use different methods of capturing screen image data. These are called rendering modes. For more information, see Rendering modes.
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 = trueEventTracking eventTracking = Smartlook.getInstance().getPreferences().getEventTracking();
eventTracking.getNavigation().enableAll();
eventTracking.getNavigation().disableAll();
eventTracking.getNavigation().setActivityEnabled(true);
eventTracking.getNavigation().setFragmentEnabled(true);
Fragmentnavigation 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::classEventTracking 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 = trueEventTracking 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();