- Getting Started
- Billing
- Voiceprint Phrases
- Plist Permissions
- Local Installation
- Usage
- Funtions
- User Token Initializing
- Theme Color
$ npm install react-native-voiceit --save
Please make sure that the minimum Deployment Target for your project is IOS 11
The minumum Android SDK version (API level) should be set to 17 in your build.gradle file:
minSdkVersion: 17
In order to use en-US or other content languages you need to have a developer account that has funds. In order to add funds to your account please login at: https://voiceit.io/login and navigate to: https://voiceit.io/billing and add funds.
Make sure you review your Voiceprint Phrases by navigating to: https://voiceit.io/phraseManagement in order to know what to pass for voicePrintPhrase parameter
For IOS, please make sure your project has Camera and Microphone permissions in the info.plist file. Also, make sure that the app runs in light theme. Add the following inside the XML:
<key>NSCameraUsageDescription</key>
<string>This app requires to access your camera for biometric services</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app requires to access your microphone for biometric services</string>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
$ react-native link react-native-voiceit
Firstly, to use the SDK locally, please clone the repo and drag it into your root React Native project. In the Package.json, replace to "react-native-voiceit": "file:./VoiceIt2-React-Native-SDK"
Get the Android-SDK locally by doing the following:
- Clone the Android-SDK repo
- Open your main android project/folder in android studio, and navigate to File -> New -> Import Module
- Select the Android SDK repo that you just cloned. Check off the app module, only include the voiceit2 module
- Navigate to you local VoiceIt2-React-Native-SDK Folder
- In the android/build.gradle, add ``` implementation project(path: ':voiceit2') ``` under dependencies
Please navigate to the podfile of your main IOS folder, and replace to:
pod 'react-native-voiceit', :path => '../VoiceIt2-React-Native-SDK'
pod "VoiceIt2-IosSDK", :path => './VoiceIt2-IosSDK'
import {NativeModules} from 'react-native';
const Voiceit = NativeModules.Voiceit;
// Initialize the VoiceIt Native Module
// Voiceit.init("API_KEY","API_TOKEN",(res)=>{
// console.log(res);
// } ;
// Call the methods with the same signature as the IOS/Android SDK. For instance
// Voiceit.encapsulatedFaceEnrollment("USR_ID",(res)=>{
// console.log(res);
// });
Initialize the module as follows:
import {NativeModules} from 'react-native';
const Voiceit = NativeModules.Voiceit;
Voiceit.initVoiceIt("API_KEY","API_TOKEN",(res)=>{
console.log(res);
};
The React Native SDK wraps the IOS and Android SDKs, and hence the methods exposed are the same as those. Please refer to the The Android SDK/The IOS SDK for complete method reference. For instance
voiceItModule.encapsulatedFaceVerification("USER_ID","CONTENT_LANGUAGE", LIVENESS_BOOLEAN, AUDIO_LIVENESS_BOOLEAN, (res)=>{
callback(res);
});
To initialize Voiceit Module with User token and not use your API key and token, first generate a user token: https://api.voiceit.io/#user-token-generation Initialize Voiceit by placing the generated user token in palce of the API Key, and leave the API token as blank:
Voiceit.initVoiceIt("GENERATED_USER_TOKEN","",(res)=>{
console.log(res);
};
To set a theme color, please initialize the voiceit Object as follows:
Voiceit.initVoiceItWithTheme("API_KEY","API_TOKEN", "HEX_COLOR_VALUE",(res)=>{
console.log(res);
};
Example:
Voiceit.initVoiceItWithTheme("key_...","tok_.....", "#fbc132",(res)=>{
console.log(res);
};