Comment on page
Getting started
This page presents the first steps to using the Identity SDK for React Native.
For security reasons, our repository is private, if you want to perform the integration with the product, please contact the person responsible for your service.
- 1.Copy the files
CombateAFraudeModule.java
andCombateAFraudePackage.java
, located in the example repository in the pathSDKsExample/android/app/src/main/java/com/sdksexample/
**** to the folder ****<root-project>/android/app/src/main/java/com/<your-package-name>
in your project.
Note: the functiongetName
will be used to call the method on the React Native side; The method annotated with @ReactMethod will be used for the calls on the React Native side.
2. Reference the module in your
MainApplication.java
import com.<your-package-name>;
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
...
packages.add(new CombateAFraudePackage());
...
}
3. In the
<root-project>/android/build.gradle
file add our Maven repository and the minSdkVersion
setting for at least API 21:buildscript {
ext {
minSdkVersion = 21
}
}
allprojects {
repositories {
maven { url "https://repo.combateafraude.com/android/release" }
}
}
4. In the
<root-project>/android/app/build.gradle
file add our project settings:android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
aaptOptions {
noCompress "tflite"
}
dataBinding {
enabled = true
}
}
5. In the same file, add the Identity dependencies:
dependencies {
implementation 'com.combateafraude.sdk:identity:<sdk_version>'
}
6. Update the dependencies by running the following commands:
cd android
./gradlew clean bundleRelease
./gradlew build --refresh-dependencies
Note: Check that you are running Java version 1.8. If not, run it:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
- 1.In the
<root-project>/ios/Podfile
, make sure the minimum iOS version is 12.4+, add the lineuse_frameworks!
and disable Flipper:
platform :ios, '12.4'
use_frameworks!
target '<app-name>' do
...
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
end
target '<app-name>-tvOS' do
...
end
source 'https://github.com/combateafraude/iOS.git'
source 'https://cdn.cocoapods.org/'
2. In the same file, add the iOS SDKs you want to use:
target '<app-name>' do
pod 'Identity', '~> <version>'
end
3. Run the command
cd ios && pod install && cd ..
to install the dependencies4. Copy the
SDKsExample-Bridging-Header.h
, CombateAFraude.m
and CombateAFraude.swift
files, located in the repository in the **SDKsExample/ios
** path, to the <root-project>/ios
folder5. In case you have any issues running the project after completing all the steps, add this code line in your Podfile and run the command
cd ios && pod install && cd ..
post_install do |installer|
fix_deployment_target(installer)
enable_bitcode(installer)
end
# This resolves any possible deployment issue by making sure it is the same as the project
def fix_deployment_target(installer)
return if !installer
project = installer.pods_project
project_deployment_target = project.build_configurations.first.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
puts "Make sure all pods deployment target is #{project_deployment_target.green}"
project.targets.each do |target|
puts " #{target.name}".blue
target.build_configurations.each do |config|
old_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
new_target = project_deployment_target
next if old_target == new_target
puts " #{config.name}: #{old_target.yellow} -> #{new_target.green}"
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = new_target
end
end
end
def enable_bitcode(installer)
return if !installer
installer.pods_project.build_configurations.each do |config|
# config.build_settings['ENABLE_BITCODE'] = 'YES'
# config.build_settings['OTHER_CFLAGS'] = '-fembed-bitcode'
# config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
config.build_settings['DEAD_CODE_STRIPPING'] = 'YES'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
The
App.js
file in the example repository shows how to call these methods and access their results.Last modified 8mo ago