VideoCall Component
1. Introduction
Mobile SDK is a set of libraries (Components) that offers a series of functionalities and services, allowing its integration into a Mobile application in a simple, totally scalable way. Depending on the use case that is required, the installation of certain components must be carried out. Its high level of modularity allows that, in the future, other new components can be added without affecting at all those already integrated into the project.
The Component addressed in the current document is named SelphID Component. This is responsible for capturing documents and the subsequent extraction and analysis of the data obtained from them. Its main functionalities are the following:
-
Internal camera management.
-
Permissions management.
-
Assists in the processes of capturing the front and back of the document.
-
Extraction of the information contained in the document.
-
Obtaining the images of the back and reverse of the document, as well as other images included in the document: user's face, user's signature,...
-
High level of configuration: different countries, languages, types of documents...
1.1 Minimum requirements
The minimum native version (Android and iOS) of the SDK are as follows:
-
Minimum Android version: 24 - JDK 11
-
Minimum iOS version: 13
Regarding the architecture of the mobile device:
- armeabi-v7, x86, arm64 and x64
1.2 Plugin version
The current plugin version can be checked as follows:
-
We look for the package.json file at the root of the plugin.
-
The KEY/TAG version indicates the version.
2. Component integration
Before integrating this component, it is recommended to read the documentation related to Core Component and follow the instructions indicated in said document.
ℹ️ For this section, the following values will be considered:
-
<%APPLICATION_PATH%> - Path to the root of the application (example: /folder/example)
-
<%PLUGIN_CORE_PATH%> - Path to the root of the core plugin, which is mandatory (example: /folder/sdk-core)
-
<%PLUGIN_SELPHID_PATH%> - Path to the root of the current plugin (example: /folder/sdk-selphid)
2.1. Plugin installation: Common
The plugin allows execution on Android and iOS platforms. This section explains the common steps to all platforms. To install the plugin, the following steps must be adopted:
- Make sure react-native is installed.
- Access <%APPLICATION_PATH%> at a terminal and run:
yarn add @facephi/sdk-core-react-native
yarn add @facephi/sdk-selphid-react-native
yarn install
- In addition, to install the plugin on iOS, the following must also be executed:
cd ios
pod install
- It is important to verify that the path to the plugin is correctly defined in package.json:
"dependencies": {
"sdk-core-react-native": <% PLUGIN_CORE_PATH %>,
"sdk-selphid-react-native": <% PLUGIN_SELPHID_PATH %>
}
After running the above steps, you can start the app with the sdk/component installed.
- Finally, to launch the projects, the following commands must be executed in two ways:
From Terminal
For Android:
npx react-native run-android
or
npx react-native run-android --active-arch-only
For iOS:
npx react-native run-ios
From different IDEs
Projects generated in the Android and iOS folders can be opened, compiled, and debugged using Android Studio and XCode respectively.
2.2 Plugin installation: iOS
2.2.1 Project configuration
For the iOS version, when adding our plugin to the final application, the following points must be previously taken into account:
- Add camera permissions: To use the widget, you need to enable the camera permission in the application's info.plist file (included within the project in the ios folder). You will need to edit the file with a text editor and add the following key/value pair:
<key> NSCameraUsageDescription </key>
<string>$(PRODUCT_NAME) uses the camera</string>
2.2.2 Podfile Update
In the project podfile it will be necessary to add the information from the private repository (see section 2.1). To do this, the following lines must be added at the beginning of the file:
platform :ios, '13.0' //MIN VERSION
plugin 'cocoapods-art', :sources => ['cocoa-pro-fphi']
source 'https://cdn.cocoapods.org/'
ℹ️ To know more about the configuration and use of Cocoapods Artifactory, it is necessary to access the following document of Core Component.
2.2.3 Possible issues
If environmental problems occur or the plugin is not updated after making new changes (for example, problems occurred due to the bundle not being generated correctly, or the libraries not being updated to the correct versions), it is recommended to execute the following sequence of instructions after launching the plugin:
-
Open the application's ios folder at a terminal.
-
Run the following command:
pod deintegrate
-
Remove the Podfile.lock
-
Run the following command (or open the project with Xcode and run it):
pod install --repo-update
2.3 Plugin installation: Android
2.3.1 Set Android SDK version
For Android, the minimum SDK version required by our native libraries is 24, so if your app has a Minimum SDK defined less than this, it will need to be modified to avoid a compile error. To do this, access the application's build.gradle file (located in the android folder) and modify the following parameter:
buildscript {
ext {
minSdkVersion = 24
}
}
2.3.2 Permissions for geolocation
Because the Tracking component has geolocation options, it is necessary to add the permissions for it. In the AndroidManifest add the following permissions:
<!-- Always include this permission -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- Include only if your app benefits from precise location access. -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
3. Component configuration
The current component contains a number of Typescript methods and interfaces contained within the node_modules/@facephi/sdk-selphid-react-native/src/index.tsx file. ** In this file you can find the necessary API for the communication between the application and the native functionality of the component. It is then explained what each one of those listed is for and the other properties that affect the operation of the component.
The following is the SelphIDConfiguration class, which allows you to configure the SelphID component:
export interface SelphidConfiguration {
debug?: boolean;
fullScreen?: boolean;
frontalCameraPreferred?: boolean;
tokenImageQuality?: number;
widgetTimeout?: number;
showResultAfterCapture?: boolean;
showTutorial?: boolean;
tutorialOnly?: boolean;
scanMode?: string;
specificData?: string;
documentType?: string;
videoFilename?: string;
fullscreen?: boolean;
locale?: string;
documentModels?: string;
enableWidgetEventListener?: boolean;
generateRawImages?: boolean;
translationsContent?: string;
viewsContent?: string;
cameraId?: number;
params?: any;
resourcesPath?: string;
tokenPrevCaptureData?: string;
wizardMode?: boolean;
documentSide?: string;
showDiagnostic?: boolean;
compressFormat?: SdkCompressFormat,
imageQuality?: number,
}
Then, all the properties that can be defined in the SdkTracking object will be commented on:
ℹ️ All the configuration can be found in the component's src/index.tsx file.
When making the call to the widget there is a series of parameters that must be included. They will be briefly discussed below.
3.1 resourcesPath
type: string
Sets the name of the resource file that the widget will use for its graphical configuration. This file is customisable and is located in the plugin in the src/main/assets folder for Android and in the ios/Frameworks and Resources folder for iOS. Its installation is transparent to the user, it will simply be added to the respective platform's projects during plugin installation. More details about how this resource pack works and how to modify it are explained in section 6.
resourcesPath: "fphi-selphid-widget-resources-sdk.zip"
3.2 ShowResultAfterCapture
type: boolean
Indicates whether or not to display a screen with the captured image of the document after the analysis process. This screen gives the user the option of repeating the capture process if the image obtained from the document is not correct.
showResultAfterCapture: false
3.3 ScanMode (WidgetScanMode)
type: WidgetScanMode
This enumeration is defined in the js/WidgetSelphidEnums.js class. Indicates the OCR scanning mode of the documents. Depending on the choice, several types of documents or one in particular will be scanned and searched. This mode can be of three types:
-
SelphIDScanMode.Generic: The generic mode that allows you to scan any type of document regardless of the country or the type of document. The result of this mode is not as accurate as the following, but it allows you to scan various standard documents.
-
SelphIDScanMode.Search: The search mode will allow you to use a whitelist and blacklist, and will search the documents that meet those conditions. These conditions are specified in the "specificData" variable. In this way it is possible to carry out the search limiting the number of templates, and making the search much more refined than in the generic case.
-
SelphIDScanMode.Specific: Search for a specific document. These conditions are indicated in the "specificData" property shown below.
scanMode: SdkSelphidEnums.SdkScanMode.Search;