- To install the SDK run the below command in the terminal at the root of your project, run npm install rn-smile-id
- The Smile ID Config file (smile_config.json) would be shared with you or downloaded from the smile id portal
- For iOS open the ios project and place this file at the root of your project and for android place this file at the root of the main module (usually app folder) this step is critical and your project will behave unexpectedly if these are not done right.
- In your root-level (project-level) Gradle file (build.gradle), add rules to include the Maven Central repository.
buildscript { repositories { mavenCentral() // add the maven central repository
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
}
-
In your module (app-level) Gradle file (usually app/build.gradle), apply the Smile ID android plugin:
apply plugin: 'com.smileidentity.smile-id-android' -
Declare the Smile ID android SDK in your root level Gradle file (usually build.gradle).
dependencies {
classpath group: 'com.smileidentity', name: 'smile-id-android', version: '1.0.1'
}
- Add the following permissions if they do not exist already
`<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />`
- Add the following activities under the application tag
<activity android:name="com.smileid.smileidui.SIDIDCaptureActivity" /> <activity android:name="com.smileid.smileidui.SIDSelfieCaptureActivity" /> <activity android:name="com.smileid.smileidui.SIDReviewActivity" />
The SDK only runs on 64 bit processors arm64 and x86_64 and does not support armv7 and i386.
Close your XCode if your project is open and from the terminal, navigate to the iOS folder in the react native and run
pod install
- If you want the SDK to generate a tag for you then call the method with an empty string
const data = await RnSmileId.captureSelfie('');
- If you want the generate to use a custom tag send a string to the SDK with alphanumeric characters with the exception of an underscore and no spacing in them.
const data = await RnSmileId.captureSelfie(); The selfie capture process is an asynchronous process and will return an error code and a tag once done. The result looks as the below
const resultCode = data.SID_RESULT_CODE;
const resultTag = data.SID_RESULT_TAG;
If the result code is -1 AND the tag is not null or empty then the selfie capture was successful.
const result = await RnSmileId.submitJob(
tag: string,
jobType: number,
isProduction: boolean,
partnerParams: object,//optional pass {} when not available
idInfo: object,//optional pass {} when not available
geoInfo: object//optional pass {} when not available
);
- tag: required and if this is job type which involve a selfie it must have been a tag that has already captured a job before this method is called.
- jobType: required and must be a valid job type as listed on the products page on the left
- isProduction: required and is a boolean true or false. If false the jobs will be sent to sandbox if true jobs will be sent to production
- partnerParams: { "job_id": "unique id", "user_id": "unique id", }
- idInfo: (optional) This is mandatory for document verification but is used as the case may be for job type Enhanced KYC + SmartSelfie. the object is described below
{
country: "country",
id_type: "idType",
id_number: "idNumber",
first_name: "firstName",
middle_name: "middleName",
last_name: "lastName",
email: "email",
}
The method will return a result accessible in our example as result.result.
This object is an object documented in the return value section of your chosen product type under the products section on the left the most important of these being the result.
ResultCode which shows the state and result from the job you have just run