Skip to main content

Installation

Installing the package​

1. Configuring the npm registry​

Create an .npmrc file at the root of your project:

@qitech:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=NPM_TOKEN_SENT_BY_QI_TECH

Replace NPM_TOKEN_SENT_BY_QI_TECH with the token provided by support. If you have not received your token yet, contact suporte.caas@qitech.com.br.

2. Installing the dependency​

yarn add @qitech/react-native-device-scan

3. Import​

import {
CAAS_ENVIRONMENT,
startDeviceScan,
} from '@qitech/react-native-device-scan';

Android setup​

1. QI Tech Maven repository​

Add QI Tech's Maven repository to your project-level build.gradle:

allprojects {
repositories {
maven { url 'https://sdks.qitech.com.br/' }
...
}
}

2. AdMob​

Initialize the AdMob service by adding the following code to your AndroidManifest.xml:

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="<ADMOB_APP_ID>"/>

If you do not have an ADMOB_APP_ID, contact suporte.caas@qitech.com.br.

3. Permissions​

Declare in your AndroidManifest.xml the permissions you want to make available to the SDK. See Permissions for the full list.

iOS setup​

1. QI Tech iOS repository source​

Add the following sources at the top of your Podfile:

source 'https://cdn.cocoapods.org/'
source 'https://github.com/QITechSDKs/iOS.git'

2. Static frameworks​

Required only if you use Xcode older than version 26:

use_frameworks! :linkage => :static
Warning

Flipper does not work with use_frameworks!. Remove the use_flipper() call from your Podfile if it is present.

3. Module stability​

The Datadog dependencies require BUILD_LIBRARY_FOR_DISTRIBUTION to be enabled. Add the post_install block below (or merge it into your existing post_install):

post_install do |installer|
installer.pods_project.targets.each do |target|
if ['DatadogCore', 'DatadogInternal', 'DatadogCrashReporting', 'DatadogLogs'].include?(target.name)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.5'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
end

4. Permissions​

Declare in your Info.plist the permissions you want to make available to the SDK. See Permissions.

5. Installing the pods​

cd ios && pod install

Expo setup​

The package includes an Expo config plugin that automatically applies all the native iOS and Android setup described above. In your app.json:

{
"expo": {
"plugins": ["@qitech/react-native-device-scan"]
}
}

Then run prebuild to apply the native changes:

npx expo prebuild