React Native
This will guide you to integrate the Kvalifika SDK into your React Native project
Before integrating Kvalifika, it is recommended to follow the steps described in Integration Guide and Initial Setup.
Naming of the properties and functions might be slightly modified depending on the version.
Installation
Add NPM dependency by running
or
For React Native <0.60
If your React Native version is larger than >= 0.60, you can ignore this step. Otherwise, please run the following command:
react-native link @kvalifika/react-native-sdk
iOS Specific Steps
Add sources to Podfile and use minimum iOS version 11.0
Then navigate to ios
folder and run pod install
pod install
might take a long time!
App Permissions
Please add the following permissions to your app's Info.plist, so that the Kvalifika iOS SDK can access a user's camera to run a verification. You can do this in the property list view or by code. Right-click on Info.plist and select Open As -> Source Code. Add the lines below somewhere inside the file:
Create Objective C Bridging Header
After the pods are installed, open your project's .xcworkspace
file in Xcode. Add a blank Swift file to your project (File -> New -> Swift File), with a bridging header (it will prompt you to auto-create one).
Right-click on the project's name & select a new file.
Choose and create an empty Swift file:
2. Give the name to your file:
3. Select Create Bridging Header
:
Android Specific Parts
After installing NPM package, please do the following steps to set up the Android environment:
Please add the following lines to
android/build.gradle
file:Set
minSdkVersion
to21
or higherAdd maven URL to repositories:
maven { url 'https://s3.eu-central-1.amazonaws.com/com.kvalifika.sdk' }
Code Example
Initialize the SDK
After that, you need to initialize SDK inuseEffect
with your appId.
appId is Application ID, generated from Admin Panel. See Initial Setup for details.
Start Verification
Call KvalifikaSDK.startSession()
on button press:
Handling Verifications
It's useful to know that whether a user has completed the verification flow or canceled it. For this, you can implement the callback methods.
Callback Methods
Method
Description
onInitialize
This callback method is triggered when SDK is initialized.
onStart
This callback method is triggered when the user starts verification.
onFinish
This callback method is triggered when the user completes verification. Get session data here.
onError
KvalifikaSDK uses NativeEventEmitter to communicate between Android and iOS native modules. Make sure to remove callbacks on unmount.
Error Codes
Error Code
Description
INVALID_APP_ID
Kvalifika App Id is incorrect
USER_CANCELLED
User canceled before completing verification.
TIMEOUT
Canceled due to inactivity.
SESSION_UNSUCCESSFUL
The Session was not performed successfully.
ID_UNSUCCESSFUL
The ID Scan was not performed successfully and identity document data was not generated.
CAMERA_PERMISSION_DENIED
Camera is required but access is prevented by user settings.
LANDSCAPE_MODE_NOT_ALLOWED
Verification was canceled because the device is in landscape mode.
REVERSE_PORTRAIT_NOT_ALLOWED
Verification was canceled because the device is in reverse portrait mode.
FACE_IMAGES_UPLOAD_FAILED
Could not upload face images. Internal request failed.
DOCUMENT_IMAGES_UPLOAD_FAILED
Could not upload ID card or passport images. Internal request failed.
NO_MORE_ATTEMPTS
User has reached maximum limit of attempts
UNKNOWN_INTERNAL_ERROR
Session failed because of an unhandled internal error. This error comes with a message.
UI Customizations
Appearance
It is possible to customize the logo and icons.
In React Native we need to add the images in android
and ios
subfolders in the project directory.
Open android
subfolder in Android Studio and drag the image to res/drawable
folder.
Open ios
subfolder in XCode. Open Assets.xcassets
folder and drag the image.
An image name in android
and ios
subfolders must match.
Language
It is possible to set locale when initializing SDK. Supported locales are:
Code
Language
EN
English
GE
Georgian
RU
Russian
SP
Spanish
Development Mode
Without specifying mode SDK uses https://api.kvalifika.com
With development mode ON SDK uses https://apistaging.kvalifika.com
ProGuard (Android)
If ProGuard is used in Android release build, it is possible to add the following options to ProGuard file:
Last updated