A robust library for native integration with Urovo data collectors. Developed and tested on the DT50P; the DT50P Lite shares the same UHF RFID and barcode scanner features and is expected to work, but has not been tested. It provides full control over the UHF RFID radio module and the Barcode Scanner (Laser), allowing for power adjustments, reading modes, and physical trigger interception.
Platform: Android only. Urovo handhelds run Android, so there is no iOS implementation.
Install the library from npm:
npm install react-native-urovo-rfidThe package is also published to GitHub Packages as @rafaax/react-native-urovo-rfid. GitHub's npm registry requires authentication even for public packages, so create a personal access token (classic) with the read:packages scope and add this to your project's .npmrc:
@rafaax:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
Then install it:
npm install @rafaax/react-native-urovo-rfidDue to copyright issues, Urovo's proprietary drivers are not included in the public repository. You need to provide them:
- Obtain the files
URFIDLibrary-vX.aarandurovo_platform_sdk_vX.jarfrom your supplier. - Create a
libsfolder insidenode_modules/react-native-urovo-rfid/android/and paste both files there. - In your main application, open
android/app/build.gradleand add the following line inside thedependenciesblock:
dependencies {
// ... other dependencies
implementation files("../../node_modules/react-native-urovo-rfid/android/libs/URFIDLibrary-v2.5.1230.aar")
}| react-native-urovo-rfid | React Native | New Architecture | Tested device |
|---|---|---|---|
| 1.0.x | 0.84.1 | yes (newArchEnabled=true) |
DT50P |
- Tested with React Native 0.84.1 (React 19.2.3) with Hermes enabled. Other React Native versions have not been tested.
- Android only:
minSdk24,compileSdkandtargetSdk36. - The DT50P Lite is expected to work, but has not been tested.
Import the RFID module in your code:
import { UrovoRfidNative } from 'react-native-urovo-rfid';| Method | Parameters | Return | Description |
|---|---|---|---|
initAntenna() |
None | Promise<boolean> |
Turns on the RFID board and initializes serial communication. Should be called when opening the app. |
setPower(power) |
power: number (0 to 30) |
Promise<boolean> |
Sets the antenna power. 0 for short distances, 30 for long distances. |
setBeep(isEnable) |
isEnable: boolean |
Promise<boolean> |
Enables/Disables the native motherboard beep when reading a TAG. |
startInventory() |
None | Promise<boolean> |
Starts continuous reading of multiple TAGs. |
stopInventory() |
None | Promise<boolean> |
Stops reading TAGs. |
startRadar(epc) |
epc: string |
Promise<boolean> |
Starts search mode. Beeps faster and returns RSSI the closer it gets to the TAG. |
stopRadar() |
None | Promise<boolean> |
Stops search mode. |
Import the Scanner module in your code:
import { UrovoScannerNative } from 'react-native-urovo-rfid';| Method | Parameters | Return | Description |
|---|---|---|---|
setScannerTriggerMode(mode) |
mode: 'HOST' | 'CONTINUOUS' | 'PULSE' |
Promise<boolean> |
Changes the trigger behavior for the barcode reader. |
HOST: Default. Hold the button to keep the laser on. Release to turn it off.PULSE: Toggle. Press the button once and release, the laser stays on until it reads something.CONTINUOUS: Hands-free. The laser stays on continuously.
The library triggers native events in real-time to Javascript. Use React Native's DeviceEventEmitter to listen to them:
import { useEffect } from 'react';
import { DeviceEventEmitter } from 'react-native';
useEffect(() => {
// 1. Listen for Read TAGs
const rfidListener = DeviceEventEmitter.addListener('onRfidRead', (epc) => {
console.log("Read TAG: ", epc);
});
// 2. Listen to Signal Strength (For Radar/Search mode)
const radarListener = DeviceEventEmitter.addListener('onRadarRssi', (rssi) => {
console.log("Target TAG signal strength: ", rssi); // from 0 to ~100
});
// 3. Listen to Physical Trigger (Collector's Yellow Button)
const triggerListener = DeviceEventEmitter.addListener('onHardwareTrigger', (isDown) => {
if (isDown === 'true') {
console.log("Finger pressed the trigger!");
// UrovoRfidNative.startInventory()
} else {
console.log("Finger released the trigger!");
// UrovoRfidNative.stopInventory()
}
});
return () => {
rfidListener.remove();
radarListener.remove();
triggerListener.remove();
};
}, []);For the best experience, we recommend isolating the logic into a Custom Hook. Here is a practical example of implementing Power Control with debounce:
import { useEffect, useRef } from 'react';
import { DeviceEventEmitter } from 'react-native';
import { UrovoRfidNative } from 'react-native-urovo-rfid';
export const useUrovo = (power = 30) => {
const isReading = useRef(false);
useEffect(() => {
// Turns on the antenna when opening the app
UrovoRfidNative.initAntenna().catch(console.error);
}, []);
useEffect(() => {
// Updates power in real-time (with debounce to prevent freezing the serial port)
const timer = setTimeout(() => {
UrovoRfidNative.setPower(power).catch(console.error);
}, 500);
return () => clearTimeout(timer);
}, [power]);
useEffect(() => {
const trigger = DeviceEventEmitter.addListener('onHardwareTrigger', (isDown) => {
if (isDown === 'true') {
UrovoRfidNative.startInventory();
} else {
UrovoRfidNative.stopInventory();
}
});
return () => trigger.remove();
}, []);
};This library was inspired by react-native-urovo by @iliapnmrv, React Native bindings for Urovo barcode scanners.
MIT. The Urovo drivers (.aar and .jar) are proprietary, are not part of this repository and are not covered by this license.