Comment on page
Getting started
This page presents the first steps for using our SDKs in a React Native application.
- 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; Methods 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 dependencies for the Android SDKs you want to use:
dependencies {
implementation 'com.combateafraude.sdk:<sdk_name>:<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 11.0+, add the lineuse_frameworks!
and disable Flipper:
platform :ios, '11.0'
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 '<framework_name>', '~> <version>'
end
3. Run the command
cd ios && pod install && cd ..
to install the dependencies 4. 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
folder 5. To enable text and voice in Portuguese, in your project, in the
ROOTPROJECT/ios
directory, open the .xcworkspace
file in Xcode and add in Project > Info > Localizations the language Portuguese (Brazil)
.The
App.js
file in the example repository shows how to call these methods and access their results.Last modified 1yr ago