1. Setting up the Environment
- Android
- iOS
1.1 Update build.gradle
In your React Native project, navigate to the android folder and open the build.gradle file. Ensure that the buildScript configuration has a minSdkVersion equal to or above 24
android/build.gradle
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}
1.2 Add Metric Repository
Add the Metric repository to the allprojects section of your android/build.gradle file (below the buildScript configuration)
android/build.gradle
allprojects {
repositories {
google()
mavenCentral()
maven {
url "http://android.metric.africa:8081/artifactory/metric-sdk-sdk"
allowInsecureProtocol true
credentials {
username = sdkUserName
password = sdkPassword
}
}
}
}
info
The sdkUserName and sdkPassword will be provided upon request.
1.1 Permissions
Add an NSCameraUsageDescription
All iOS apps which require camera access must request permission from the user, and specify this information in the Info.plist.
Add an NSCameraUsageDescription entry to your app's Info.plist, with the reason why your app requires camera access (e.g. “To allow Metric Example App access your camera in order to verify your identity.”)