This repository contains an example of integration native GetID iOS and Android SDKs into a React Native cross-platform application.
In order to start using GetID SDK, you will need an SDK KEY and API URL. Both can be found and modified either through your GetID admin panel or via contacting our integration team.
Also, make sure that you've set up the development environment.
Clone the project, navigate to the project directory and install node modules:
git clone https://github.com/vvorld/getid-react-native-example
cd getid-react-native-example
npm installUse 'npm install --legacy-peer-deps' to use legacy dependencies as is
Open App.js file and set apiUrl and sdkKey.
cd ios
pod installThen open ios/GetIDExample.workspace in Xcode and run the app or just type npx react-native run-ios in the root project directory.
Open android in Android Studio and run the app or npx react-native start in one Terminal window and command npx react-native run-android from root folder in another.
iOS
- Add
pod 'GetID', '2.8.0'toios/Podfile. The number of the latest version of GetID iOS SDK can be found here. - In
iosfolder runpod install. - Add
NSPhotoLibraryUsageDescription,NSMicrophoneUsageDescriptionandNSCameraUsageDescriptiontoios/YourProjectName/Info.plist. See description examples in this repository. - Open the
.xcworkspacefile in Xcode. SelectFile > New > File > Swift File, name itGetIDSwiftWrapper. When Xcode asks whether you want to add a bridging header file, confirm that you want to create it. - Select
File > New > File > Cocoa Touch Class, subclass ofNSObject, languageObjective-C, name itRCTGetID. - Copy content of
RCTGetID.h,RCTGetID.mandGetIDSwiftWrapper.swiftfrom this repository to newly created files. Rename an import inRCTGetID.mto#import "YourProjectName-Swift.h".
Android
- Add
jcenter()toallprojects.repositoriesinbuild.gradlebeforemavenCentral(). - Add
implementation 'ee.getid:getidlib:2.7.5'toandroid/app/build.gradle. The number of the latest version of GetID Android SDK can be found here. - Add
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'toandroid/app/build.gradle. - Copy
GetID.javafile from this repository toandroid/app/src/main/java/com/yourprojectname. - Copy
MyAppPackage.javafile from this repository toandroid/app/src/main/java/com/yourprojectname. - Add
packages.add(new MyAppPackage());inMainApplication.java. See the exact place in this repository. - Remove
android:allowBackup="false"fromAndroidManifest.xml. - Copy the GetID activity to
AndroidManifest.xmlfrom this repository.
Common
In a .js file, in the place you want to start the GetID verification flow, you have to call GetID.start(apiUrl, token, flowName);. For example, see App.js file in this repository.