Installing the React Native Data Capture Modules
To install the SDK, run the following in your root project folder:
- npm
- Yarn
- Expo
npm install react-native-scanbot-sdk
yarn add react-native-scanbot-sdk
npx expo install react-native-scanbot-sdk
Android
Since your application will work with high-resolution images, we strongly recommended to add the property android:largeHeap="true" in the <application> element of your android/app/src/main/AndroidManifest.xml file, especially for Android <= 7.x.
Processing high-resolution images is a memory-intensive task and this property will ensure your app has enough heap allocated to avoid OutOfMemoryError exceptions.
<application ... android:largeHeap="true">
...
</application>
Integration with Expo
Integration with Expo is possible only when using a Development Build, not Expo Go. The project is configurable using our config plugin or by manually configuring the native projects.
To utilize the plugin, add the following in your app config file:
"plugins": [
[
"react-native-scanbot-sdk",
{
"iOSCameraUsageDescription": "Document & Barcode Scanning permission",
"largeHeap": true,
"mavenURLs": true,
"ocrBlobsDirPath": "./ocr_blobs"
}
]
],
iOSCameraUsageDescription: AddsNSCameraUsageDescriptionin Info.plist. The permission can also be added via Expo Permissions.largeHeap: Addsandroid:largeHeapproperty in<application>element in AndroidManifest.xml.mavenURLs: Adds Scanbot SDK Maven URLs for Android local development. These URLs are already included in the package's build.gradle, but need to be added due to how Expo starts the Android app.ocrBlobsDirPath: Addsocr_blobsfor Android and iOS. Specify a path of a directory that contains only.traineddatafiles.- For Android, the files are copied over from the specified path in android/app/src/main/assets/ocr_blobs.
- For iOS, a
ScanbotSDKOCRData.bundleis created and added as a resource, and the files are copied over from the specified path.
For more details, please refer to the OCR section.
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get free trial license