Skip to content

Initialization

The Face SDK initialization is performed after the Web Service configuration and the Mobile SDK installation. If you have not completed them, refer back to the corresponding pages before proceeding with initialization:

Info

The Core Basic and Core Match frameworks are described on the Installation page.

Core Basic

For Core Basic initialization, you do not need a license file and can simply use the code below:

FaceSDK.Instance().initialize(context) { status: Boolean, exception: InitException? -> {

} }
FaceSDK.Instance().initialize(context, (status, exception) -> { });
FaceSDK.service.initialize { success, error in

}
[[RFSFaceSDK service] initializeWithCompletion:^(BOOL success, NSError * _Nullable error) {

}];

Core Match

Core Match requires initialization with a license file of an ML or OL type, see the Licensing page for details. You can obtain a demo license at our Client Portal or by contacting our sales team .

Warning

To simultaneously use both the Document Reader SDK and Face SDK for client-side computing operations on a mobile device, it's essential to employ a single license file granting permissions for both products. Reach out to the sales team for assistance in obtaining such a license file.

The initializeWithConfiguration method is designed to perform the initialization process. It accepts an instance of the InitializationConfiguration class as a configuration object. It allows you to set the license and other configuration properties.

For more information, consult the iOS API Reference.

Here is an example of how to perform initialization with the license stored in the application bundle:

let filePath = Bundle.main.path(forResource: "regula", ofType: "license")!
let licenseData = NSData(contentsOfFile: filePath)! as Data
let initConfiguration = InitializationConfiguration {
    $0.licenseData = licenseData
}

FaceSDK.service.initialize(configuration: initConfiguration) { success, error in
}
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"regula" ofType:@"license"];
NSData *licenseData = [NSData dataWithContentsOfFile:filePath];
RFSInitializationConfiguration *initConfiguration = [RFSInitializationConfiguration configurationWithBuilder:^(RFSInitializationConfigurationBuilder * _Nonnull builder) {
    [builder setLicenseData:licenseData];
}];

[RFSFaceSDK.service initializeWithConfiguration:initConfiguration completion:^(BOOL success, NSError * _Nullable error) {       
}];

By default, the Face SDK attempts to access the licensing server to keep your license updated. You can turn this option off:

let filePath = Bundle.main.path(forResource: "regula", ofType: "license")!
let licenseData = NSData(contentsOfFile: filePath)! as Data
let initConfiguration = InitializationConfiguration {
    $0.licenseData = licenseData
    $0.licenseUpdate = false
}

FaceSDK.service.initialize(configuration: initConfiguration) { success, error in
}
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"regula" ofType:@"license"];
NSData *licenseData = [NSData dataWithContentsOfFile:filePath];
RFSInitializationConfiguration *initConfiguration = [RFSInitializationConfiguration configurationWithBuilder:^(RFSInitializationConfigurationBuilder * _Nonnull builder) {
    [builder setLicenseData:licenseData];
    [builder setLicenseUpdate:NO];
}];

[RFSFaceSDK.service initializeWithConfiguration:initConfiguration completion:^(BOOL success, NSError * _Nullable error) {       
}];

The initialize method is designed to perform the initialization process. It accepts an instance of the InitializationConfiguration class as a configuration object. It allows you to set the license and other configuration properties.

For more information, consult the Android API Reference.

Here is an example of how to perform initialization with the license stored in the application bundle:

val license: ByteArray = getLicense()
val configuration =
    InitializationConfiguration.Builder(license).build()
FaceSDK.Instance().initialize(MainActivity.this, configuration,
    FaceInitializationCompletion { status, exception -> })
byte[] license = getLicense();
InitializationConfiguration configuration = new InitializationConfiguration.Builder(license).build();
FaceSDK.Instance().initialize(MainActivity.this, configuration, new FaceInitializationCompletion() {
    @Override
    public void onInitCompleted(boolean status, @Nullable @org.jetbrains.annotations.Nullable InitException exception) {

    }
});

By default, the Face SDK attempts to access the licensing server to keep your license updated. You can turn this option off:

val license: ByteArray = getLicense()
val configuration =
    InitializationConfiguration.Builder(license).setLicenseUpdate(false).build()
FaceSDK.Instance().initialize(MainActivity.this, configuration,
    FaceInitializationCompletion { status, exception -> })
byte[] license = getLicense();
InitializationConfiguration configuration = new InitializationConfiguration.Builder(license).setLicenseUpdate(false).build();
FaceSDK.Instance().initialize(MainActivity.this, configuration, new FaceInitializationCompletion() {
    @Override
    public void onInitCompleted(boolean status, @Nullable @org.jetbrains.annotations.Nullable InitException exception) {

    }
});

Deinitialization

After the SDK is initialized and running, it may consume hundreds of megabytes. In most cases, once the processing is finished, there is no need to keep the SDK in the memory. To prevent excessive memory consumption, you can deinitialize the SDK after using:

FaceSDK.Instance().deinitialize()
FaceSDK.Instance().deinitialize();
FaceSDK.service.deinitialize()
[[RFSFaceSDK service] deinitialize];

Next Step