Class SelfieScan.Builder
-
- All Implemented Interfaces:
public final class SelfieScan.BuilderBuilder for constructing a SelfieScan module configuration.
- Since:
-
-
Constructor Summary
Constructors Constructor Description SelfieScan.Builder()
-
Method Summary
Modifier and Type Method Description final SelfieScan.Builderfrom(SelfieScan existingSelfieScan)Creates a new Builder pre-populated with all settings from an existing SelfieScan instance. final SelfieScan.BuildersetShowTutorials(Boolean showTutorials)Shows tutorials on how to capture a selfie before the actual scan. final SelfieScan.BuildersetWaitForTutorials(Boolean waitForTutorials)Hides the continue button in the tutorial screen while tutorial animation is playing, to make sure the user has seen it before continuing. final SelfieScan.BuildersetMode(SelfieScan.Mode mode)Sets the SelfieScan.Mode to one of: Mode.ENROLL, Mode.LOGIN or Mode.MASK_CHECK. final SelfieScan.BuildersetCameraFacing(CameraFacing cameraFacing)Sets the direction that the camera faces. final SelfieScan.BuildersetFaceRecognitionMode(SelfieScan.FaceRecognitionMode faceRecognitionMode)Sets the FaceRecognitionMode to one of FaceRecognitionMode.LOCAL or FaceRecognitionMode.SERVER. final SelfieScan.BuildersetLivenessDetectionMode(SelfieScan.LivenessDetectionMode livenessDetectionMode)Sets the Liveness Detection mode (LivenessDetectionMode.LOCAL or LivenessDetectionMode.SERVER). final SelfieScan.BuildersetFaceAuthMode(SelfieScan.FaceAuthMode mode)Sets the face authentication mode for this session. final SelfieScan.BuildersetAllowFaceAuthModeFallback(Boolean allowFaceAuthModeFallback)Specify true to perform FaceAuthMode.SERVER face login if FaceAuthMode.LOCAL cannot be performed due to a missing face template on the device. final SelfieScan.BuildersetBrightnessThreshold(Float brightnessThreshold)Adjusts the minimum requirements for a well-lit face during capture. final SelfieScan.BuildersetCustomerToken(String customerToken)Sets the customer token to be used for the face login feature. final SelfieScan.BuildersetCustomerUUID(String customerUUID)Sets the ID that uniquely identifies the pre-authorized user performing face login. final SelfieScan.BuildersetEyesClosedCheckEnabled(Boolean eyesClosedCheckEnabled)Enables or disables the eyes closed check. final SelfieScan.BuildersetHeadCoverCheckEnabled(Boolean headCoverCheckEnabled)Enables or disables the head cover check. final SelfieScan.BuildersetLensesCheckEnabled(Boolean lensesCheckEnabled)Enables or disables the lenses check. final SelfieScan.BuildersetMaskCheckEnabled(Boolean maskCheckEnabled)Specify true to enable local face mask check detection during face capture. final SelfieScan.BuildersetBrightnessCheckEnabled(Boolean brightnessCheckEnabled)Specify true to enable brightness check during face capture. final SelfieScan.BuildersetFaceOcclusionEnabled(Boolean faceOcclusionEnabled)Specify true to enable face occlusion check during face capture. final SelfieScan.BuildersetStoreLocalAuthenticationEnabled(Boolean storeLocalAuthenticationEnabled)Enables storing the face login attempts in the local database. final SelfieScan.BuildersetLogAuthenticationEnabled(Boolean logAuthenticationEnabled)Ensures that all the on-device processing data in FaceAuthMode.LOCAL mode gets sent to the server. final SelfieScan.BuildersetAssistedOnboardingEnabled()Enables assisted onboarding (back-camera-only onboarding). final SelfieScan.BuildersetLogo(@DrawableRes() Integer logoResId)Used to provide a custom logo to supported screens in the SelfieScan module. final SelfieScan.BuildersetAutoCaptureTimeout(Integer autoCaptureTimeout)Sets the selfie auto capture timeout in seconds. final SelfieScan.BuildersetCaptureAttempts(Integer captureAttempts)Sets the selfie capture attempts. final SelfieScan.BuildersetStreamFramesEnabled(Boolean streamFramesEnabled)Enables or disables video streaming of the SelfieScan module. final SelfieScan.BuildersetStreamAudioEnabled(Boolean enabled)Enables or disables audio during streaming of the SelfieScan module. final SelfieScan.BuildersetStreamFramesToken(String streamFramesToken)Sets the OpenTok streaming token used for streaming a login attempt when SelfieScan mode is set to Mode.LOGIN. final SelfieScan.BuildersetVideoLivenessRecordingEnabled(Boolean enabled)Enables or disables video recording for video liveness checks of the SelfieScan module in com.incode.welcome_sdk.SdkMode.CAPTURE_ONLY mode. final SelfieScan.BuildersetDeepsightConfiguration(DeepsightConfiguration configuration)Configures the Deepsight liveness modality and motion collection for SelfieScan. final SelfieScan.BuildersetImageQualityCheckSeverity(SeverityLevel level)Sets how strict the image quality check is during face capture. final SelfieScan.BuildersetFaceOcclusionSeverity(SeverityLevel level)Sets the severity for the face occlusion check during face capture. final SelfieScan.BuildersetOnDeviceFaceResultsSubmissionEnabled(Boolean enabled)Enables or disables running liveness detection and age estimation on-device, then submitting the resulting score to the backend. final SelfieScanbuild()Constructs the SelfieScan module with the current builder configuration. -
-
Method Detail
-
from
final SelfieScan.Builder from(SelfieScan existingSelfieScan)
Creates a new Builder pre-populated with all settings from an existing SelfieScan instance.
- Parameters:
existingSelfieScan- The SelfieScan instance to copy settings from.- Returns:
A new Builder with all fields copied from existingSelfieScan.
- Since:
-
setShowTutorials
final SelfieScan.Builder setShowTutorials(Boolean showTutorials)
Shows tutorials on how to capture a selfie before the actual scan.
- Parameters:
showTutorials- true to show the tutorial, false to skip it; Default: true.- Returns:
Builder
- Since:
-
setWaitForTutorials
final SelfieScan.Builder setWaitForTutorials(Boolean waitForTutorials)
Hides the continue button in the tutorial screen while tutorial animation is playing, to make sure the user has seen it before continuing.
Note: Does nothing if SelfieScan.showTutorials is false.
- Parameters:
waitForTutorials- true to wait for tutorial animations to finish before continuing, false otherwise; Default: false.- Returns:
Builder
- Since:
-
setMode
final SelfieScan.Builder setMode(SelfieScan.Mode mode)
Sets the SelfieScan.Mode to one of: Mode.ENROLL, Mode.LOGIN or Mode.MASK_CHECK.
- Parameters:
mode- Selfie Scan mode (Mode.ENROLL, Mode.LOGIN, or Mode.MASK_CHECK); Default: Mode.ENROLL.- Returns:
Builder
- Since:
-
setCameraFacing
final SelfieScan.Builder setCameraFacing(CameraFacing cameraFacing)
Sets the direction that the camera faces. It can be CameraFacing.FRONT or CameraFacing.BACK.
Note: This API has no effect in SDK versions 5.33.1-nu, 5.33.3-nu and 5.36.0
- Parameters:
cameraFacing- direction that the camera faces (CameraFacing.FRONT or CameraFacing.BACK); Default: CameraFacing.FRONT.- Returns:
Builder
- Since:
-
setFaceRecognitionMode
@Deprecated(message = "FaceRecognitionMode is now controlled by the selfie flow configuration; this method is deprecated as of SDK 5.41.0 and its value may be overridden by configuration.") final SelfieScan.Builder setFaceRecognitionMode(SelfieScan.FaceRecognitionMode faceRecognitionMode)
Sets the FaceRecognitionMode to one of FaceRecognitionMode.LOCAL or FaceRecognitionMode.SERVER.
Note: FaceRecognitionMode is now controlled by the selfie flow configuration and this API is deprecated.
- Parameters:
faceRecognitionMode- Face Recognition mode (FaceRecognitionMode.LOCAL or FaceRecognitionMode.SERVER); Default: FaceRecognitionMode.SERVER.- Returns:
Builder
-
setLivenessDetectionMode
final SelfieScan.Builder setLivenessDetectionMode(SelfieScan.LivenessDetectionMode livenessDetectionMode)
Sets the Liveness Detection mode (LivenessDetectionMode.LOCAL or LivenessDetectionMode.SERVER).
- Parameters:
livenessDetectionMode- Liveness Detection mode (LivenessDetectionMode.LOCAL or LivenessDetectionMode.SERVER); Default: LivenessDetectionMode.SERVER.- Returns:
Builder
- Since:
-
setFaceAuthMode
final SelfieScan.Builder setFaceAuthMode(SelfieScan.FaceAuthMode mode)
Sets the face authentication mode for this session.
Note: FaceAuthMode.SERVER is deprecated as of SDK 5.49.0. Use FaceAuthMode.LOCAL, or migrate to the com.incode.welcome_sdk.modules.FaceAuthentication module for new integrations.
- Parameters:
mode- FaceAuthMode.LOCAL (recommended) or FaceAuthMode.SERVER (deprecated).- Returns:
Builder
- Since:
-
setAllowFaceAuthModeFallback
final SelfieScan.Builder setAllowFaceAuthModeFallback(Boolean allowFaceAuthModeFallback)
Specify true to perform FaceAuthMode.SERVER face login if FaceAuthMode.LOCAL cannot be performed due to a missing face template on the device. This is applied only to 1:1 face login.
- Parameters:
allowFaceAuthModeFallback- true to enable fallback to FaceAuthMode.SERVER when FaceAuthMode.LOCAL cannot be performed; Default: false.- Returns:
Builder
- Since:
-
setBrightnessThreshold
final SelfieScan.Builder setBrightnessThreshold(Float brightnessThreshold)
Adjusts the minimum requirements for a well-lit face during capture.
Note: Increasing the value will be more restrictive and require better lighting conditions, decreasing the value will loosen requirements and allow capturing while being in a darker environment. Set to 0 to ignore this setting.
- Parameters:
brightnessThreshold- minimum brightness level required for capture validation; Default: 50.- Returns:
Builder
- Since:
-
setCustomerToken
@Deprecated(message = "This is deprecated as of SDK 5.41.0, please use setCustomerUUID() instead", replaceWith = @ReplaceWith(imports = {}, expression = "setCustomerUUID(customerToken)")) final SelfieScan.Builder setCustomerToken(String customerToken)
Sets the customer token to be used for the face login feature. This token uniquely identifies a customer in the OMNI system and is returned as a result of the approve onboarding API call (e.g., the server REST API). When the customer token is set with this API, login always works in FaceRecognitionMode.SERVER mode. When using the Approval module to approve the customer there is no need to call this API to set the customer token, as it is already set internally.
- Parameters:
customerToken- used to identify the user for face login- Returns:
Builder
-
setCustomerUUID
final SelfieScan.Builder setCustomerUUID(String customerUUID)
Sets the ID that uniquely identifies the pre-authorized user performing face login. When set, 1:1 login is performed. When this value is null, 1:N login is performed.
- Parameters:
customerUUID- ID that uniquely identifies the pre-authorized user performing face login.- Returns:
Builder
- Since:
-
setEyesClosedCheckEnabled
final SelfieScan.Builder setEyesClosedCheckEnabled(Boolean eyesClosedCheckEnabled)
Enables or disables the eyes closed check. If enabled:
In auto capture mode, all frames where closed eyes are detected are filtered out and not used for further processing.
In manual capture mode, photos where closed eyes are detected are processed but the results are marked for additional review.
- Parameters:
eyesClosedCheckEnabled- true to enable eyes closed detection, false otherwise; Default: true.- Returns:
Builder
- Since:
-
setHeadCoverCheckEnabled
final SelfieScan.Builder setHeadCoverCheckEnabled(Boolean headCoverCheckEnabled)
Enables or disables the head cover check. If enabled:
In auto capture mode, all frames where head cover is detected are filtered out and not used for further processing.
In manual capture mode, photos where head cover is detected are processed but the results are marked for additional review.
- Parameters:
headCoverCheckEnabled- true to enable head cover detection, false otherwise; Default: true.- Returns:
Builder
- Since:
-
setLensesCheckEnabled
final SelfieScan.Builder setLensesCheckEnabled(Boolean lensesCheckEnabled)
Enables or disables the lenses check. If enabled:
In auto capture mode, all frames where lenses are detected are filtered out and not used for further processing.
In manual capture mode, photos where lenses are detected are processed but the results are marked for additional review.
- Parameters:
lensesCheckEnabled- true to enable lenses detection, false otherwise; Default: true.- Returns:
Builder
- Since:
-
setMaskCheckEnabled
final SelfieScan.Builder setMaskCheckEnabled(Boolean maskCheckEnabled)
Specify true to enable local face mask check detection during face capture.
- Parameters:
maskCheckEnabled- true to enable mask detection, false otherwise; Default: true.- Returns:
Builder
- Since:
-
setBrightnessCheckEnabled
final SelfieScan.Builder setBrightnessCheckEnabled(Boolean brightnessCheckEnabled)
Specify true to enable brightness check during face capture.
- Parameters:
brightnessCheckEnabled- true to enable brightness validation, false otherwise; Default: true.- Returns:
Builder Returns the updated Builder object with the brightness check configuration.
- Since:
-
setFaceOcclusionEnabled
final SelfieScan.Builder setFaceOcclusionEnabled(Boolean faceOcclusionEnabled)
Specify true to enable face occlusion check during face capture.
Make sure you have included the
com.incode.sdk:model-face-occlusion:x.y.zdependency in your[module]/build.gradle, otherwise, a com.incode.welcome_sdk.commons.exceptions.MissingModelFaceOcclusionDependencyException is thrown when this feature is enabled.- Parameters:
faceOcclusionEnabled- true to enable face occlusion detection, false otherwise; Default: false.- Returns:
Builder Returns the updated Builder object with the face occlusion check configuration.
- Since:
-
setStoreLocalAuthenticationEnabled
final SelfieScan.Builder setStoreLocalAuthenticationEnabled(Boolean storeLocalAuthenticationEnabled)
Enables storing the face login attempts in the local database.
This configuration is applicable only to the Mode.LOGIN and FaceAuthMode.LOCAL modes. When enabled, authentication attempts are stored locally, and the setLogAuthenticationEnabled configuration is bypassed.
- Parameters:
storeLocalAuthenticationEnabled- true to enable storing face login attempts locally, false otherwise; Default: false.- Returns:
Builder
- Since:
-
setLogAuthenticationEnabled
final SelfieScan.Builder setLogAuthenticationEnabled(Boolean logAuthenticationEnabled)
Ensures that all the on-device processing data in FaceAuthMode.LOCAL mode gets sent to the server.
Specify false if you want to make sure that no network calls are being performed in FaceAuthMode.LOCAL mode. Note: The authentication attempts won't be visible in the dashboard. This configuration is applicable only to the Mode.LOGIN mode.
- Parameters:
logAuthenticationEnabled- true to enable sending on-device authentication data to the server, false otherwise; Default: true.- Returns:
Builder
- Since:
-
setAssistedOnboardingEnabled
final SelfieScan.Builder setAssistedOnboardingEnabled()
Enables assisted onboarding (back-camera-only onboarding). This is equivalent to calling
setCameraFacing(CameraFacing.BACK).Note: This API has no effect in SDK versions 5.33.1-nu, 5.33.3-nu and 5.36.0
- Returns:
Builder
- Since:
-
setLogo
final SelfieScan.Builder setLogo(@DrawableRes() Integer logoResId)
Used to provide a custom logo to supported screens in the SelfieScan module.
- Parameters:
logoResId- The resource ID for the Drawable of the desired custom logo.- Returns:
Builder
- Since:
-
setAutoCaptureTimeout
final SelfieScan.Builder setAutoCaptureTimeout(Integer autoCaptureTimeout)
Sets the selfie auto capture timeout in seconds.
Note: Setting this value to zero or negative activates manual capture mode immediately.
- Parameters:
autoCaptureTimeout- timeout in seconds for auto-capture mode; when not set, the SDK uses the Dashboard/server-configured value if available, otherwise defaults to 25.- Returns:
Builder
- Since:
-
setCaptureAttempts
final SelfieScan.Builder setCaptureAttempts(Integer captureAttempts)
Sets the selfie capture attempts.
- Parameters:
captureAttempts- number of allowed selfie capture attempts; when not set, the SDK uses the Dashboard/server-configured value if available, otherwise defaults to 3.- Returns:
Builder
- Since:
-
setStreamFramesEnabled
final SelfieScan.Builder setStreamFramesEnabled(Boolean streamFramesEnabled)
Enables or disables video streaming of the SelfieScan module.
Make sure to include 'com.incode.sdk:video-streaming' to use this feature.
Dashboard equivalent: the "Enable face recording" checkbox under Face Capture configuration sets this same flag (
enableFaceRecordingin the server response). Despite the dashboard label, it controls frame streaming, not session recording. For session recording (which has no dashboard control), see com.incode.welcome_sdk.FlowConfig.Builder.configureScreenRecording.Note: This setting is ignored if any of the following are true:
The device has 2GB of RAM or less
Using com.incode.welcome_sdk.SdkMode.CAPTURE_ONLY mode
Using com.incode.welcome_sdk.SdkMode.STANDARD and the "Deepsight Liveness" Face Capture configuration option on the Incode Dashboard is set to: "Video Liveness"
- Parameters:
streamFramesEnabled- true to enable frame streaming during the SelfieScan, false otherwise; Default: false.- Returns:
Builder
- Since:
-
setStreamAudioEnabled
final SelfieScan.Builder setStreamAudioEnabled(Boolean enabled)
Enables or disables audio during streaming of the SelfieScan module.
Note: This setting is ignored if SelfieScan.Builder.setStreamFramesEnabled is false, or any conditions where the SelfieScan.Builder.setStreamFramesEnabled setting is ignored.
- Parameters:
enabled- true to stream audio along with video during SelfieScan, false otherwise; Default: false.- Returns:
Builder
- Since:
-
setStreamFramesToken
final SelfieScan.Builder setStreamFramesToken(String streamFramesToken)
Sets the OpenTok streaming token used for streaming a login attempt when SelfieScan mode is set to Mode.LOGIN.
Note: This setting is ignored if Builder.setStreamFramesEnabled is false, or any conditions where the Builder.setStreamFramesEnabled setting is ignored.
-
setVideoLivenessRecordingEnabled
@Deprecated(message = "Use setDeepsightConfiguration() instead. Map true -> Modality.VIDEO_LIVENESS, false -> Modality.SINGLE_FRAME.") final SelfieScan.Builder setVideoLivenessRecordingEnabled(Boolean enabled)
Enables or disables video recording for video liveness checks of the SelfieScan module in com.incode.welcome_sdk.SdkMode.CAPTURE_ONLY mode. Make sure to include
com.incode.sdk:camerato use this feature on the-nuline of SDK releases.Note: In com.incode.welcome_sdk.SdkMode.STANDARD mode, this setting is ignored as video liveness checks are configured server-side and only when performing an onboarding.
- Parameters:
enabled- true to enable recording of the camera feed, false otherwise; when enabled, the recording's file path is exposed via com.incode.welcome_sdk.results.SelfieScanResult.videoFilePath; Default: false.- Returns:
- Since:
Standard Releases: 5.36.0
Special Versions: 5.33.1-nu
Deprecated since 5.50.0
-
setDeepsightConfiguration
final SelfieScan.Builder setDeepsightConfiguration(DeepsightConfiguration configuration)
Configures the Deepsight liveness modality and motion collection for SelfieScan.
This replaces setVideoLivenessRecordingEnabled and mirrors the three Dashboard configuration options (Single Frame, Multimodal, Video Liveness) with an optional motion flag.
- Parameters:
configuration- A DeepsightConfiguration built via DeepsightConfiguration.Builder.- Returns:
- Since:
-
setImageQualityCheckSeverity
final SelfieScan.Builder setImageQualityCheckSeverity(SeverityLevel level)
Sets how strict the image quality check is during face capture.
Note: Higher values are more restrictive and require better capture conditions before frames are accepted, while lower values are more permissive.
- Parameters:
level- Image quality checks severity (SeverityLevel.ULTRA_LOW, SeverityLevel.LOW, SeverityLevel.MEDIUM, SeverityLevel.HIGH, or SeverityLevel.ULTRA_HIGH); Default: SeverityLevel.ULTRA_LOW.- Returns:
Builder
- Since:
-
setFaceOcclusionSeverity
final SelfieScan.Builder setFaceOcclusionSeverity(SeverityLevel level)
Sets the severity for the face occlusion check during face capture.
Lower severity is more restrictive (flags partial occlusion such as a finger over the chin), while higher severity only flags heavily occluded frames.
Make sure you have included the
com.incode.sdk:model-face-occlusion:x.y.zdependency in your[module]/build.gradle, otherwise a com.incode.welcome_sdk.commons.exceptions.MissingModelFaceOcclusionDependencyException is thrown when this feature is enabled.Note: This setting is ignored if setFaceOcclusionEnabled is false.
- Parameters:
level- Face occlusion severity (SeverityLevel.LOW, SeverityLevel.MEDIUM, or SeverityLevel.HIGH); Default: SeverityLevel.LOW.- Returns:
Builder
- Since:
-
setOnDeviceFaceResultsSubmissionEnabled
final SelfieScan.Builder setOnDeviceFaceResultsSubmissionEnabled(Boolean enabled)
Enables or disables running liveness detection and age estimation on-device, then submitting the resulting score to the backend.
For a full integration walkthrough (prerequisites, Dashboard vs code enablement, and result handling), see the On-Device Age Estimation guide.
Note: Make sure you have included the
com.incode.sdk:model-age-estimation:x.y.zandcom.incode.sdk:model-liveness-detection:x.y.zdependencies in your[module]/build.gradle, otherwise either com.incode.welcome_sdk.commons.exceptions.MissingModelAgeEstimationDependencyException or com.incode.welcome_sdk.commons.exceptions.MissingModelLivenessDetectionDependencyException is thrown when this feature is enabled.On-device processing has additional configuration requirements. The SDK aborts the session with com.incode.welcome_sdk.commons.exceptions.OnDeviceProcessingNotCompatibleException if any of the following is true:
end-to-end encryption is not enabled (enable via com.incode.welcome_sdk.SessionConfig.Builder.setE2eEncryptionEnabled),
frame streaming is enabled on the same
SelfieScan(from code via Builder.setStreamFramesEnabled or from the Incode Dashboard's "Enable face recording" Face Capture configuration),screen recording is configured for the flow via com.incode.welcome_sdk.FlowConfig.Builder.configureScreenRecording,
the flow is routed through the legacy V1 selfie UI. On-device processing requires the V2 selfie UI.
Video liveness recording is silently ignored when on-device face results submission is enabled (V2 only — V1 aborts before the camera starts per the bullet above). The recorded selfie video would otherwise be uploaded off-device, so the SDK skips that upload to preserve the on-device-only guarantee. Applies to both the client-side Builder.setVideoLivenessRecordingEnabled flag and the server-side deepsight-liveness Face Capture configuration.
-
build
final SelfieScan build()
Constructs the SelfieScan module with the current builder configuration.
- Returns:
A configured SelfieScan instance ready to be added to a flow.
- Since:
-
-
-
-