react-native-mendix-rfid-receiver
v1.1.0
Published
RFID broadcast receiver and on-device UHF reader (SEUIC uhf.jar) bridge for Mendix Native Widgets using React Native
Maintainers
Readme
Getting started
$ npm install react-native-mendix-rfid-receiver --save
Android
For android Only
Mendix
import "mx-global"; import { Big } from "big.js"; import { RfidReceiver } from 'react-native-mendix-rfid-receiver';
// BEGIN EXTRA CODE export const rfid = new RfidReceiver(); this.rfid = rfid; // END EXTRA CODE
/**
@returns {Promise.} */ export async function react_rfid() { // BEGIN USER CODE this.rfid.listenerRfid("com.zebra.rfid.ACTION", "com.symbol.datawedge.data_string", (strRfid) => { mx.data.create({ entity: "NativeModule.ExampleRfid", callback: function(mxObject) { mxObject.set("Rfid", strRfid);
mx.data.commit({ mxobj: mxObject, callback: function() { mx.data.update({ entity: "NativeModule.ExampleRfid", }); }, error: function(e) { console.log("Error occurred attempting to commit: " + e); } }); }, error: function(e) { reject("Could not create object:" + error.message); } });}); // END USER CODE }
Android Studio
Path : android\app\src\main
UHF reader (on-device, SEUIC uhf.jar)
For devices with a built-in UHF RFID reader chip (not a broadcast-intent handheld trigger).
⚠️ Required manual setup: uhf.jar
This package does not include the vendor SDK (uhf.jar, from SEUIC / your device
vendor). It is intentionally excluded from both this repo and the published npm package,
since its redistribution terms haven't been confirmed. Without it, RNUhfReceiverModule
will fail to compile — you must add it yourself before building, every time you set this
package up in a new location (fresh clone, fresh npm install, CI, a new machine, etc.).
Steps:
- Get
uhf.jarfrom SEUIC or your device vendor (it usually ships with the reader's SDK/dev kit). - Find where this package landed after
npm install, e.g.:node_modules/react-native-mendix-rfid-receiver/android/libs/(if installed locally via a Mendix widget'sfile:dependency, this is a symlink back to wherever this repo physically lives — copy the jar into the real folder, not the symlink target's parent.) - Manually copy
uhf.jarinto thatandroid/libs/folder, so the final path is:android/libs/uhf.jar - Verify it's there before building:
- Windows (PowerShell):
Test-Path node_modules/react-native-mendix-rfid-receiver/android/libs/uhf.jar - macOS/Linux:
ls node_modules/react-native-mendix-rfid-receiver/android/libs/uhf.jar
- Windows (PowerShell):
- Now run the native Android build (Gradle / Mendix native app build).
android/build.gradlein this package referencesimplementation files('libs/uhf.jar')— it will fail with a "file not found" style Gradle error if step 3 was skipped or the path is wrong.
If you're building the actual Mendix native mobile app (not just this widget/library):
the npm-published version of this package will never have uhf.jar either, so a cloud
native build (e.g. Mendix's MABS) that fetches dependencies from the public npm registry
will fail the same way. For a real production build, keep a full local copy of this
package — including your own uhf.jar — directly inside that Mendix app's own
javascriptsource/nativemodule/react-native-mendix-rfid-receiver/ folder instead of relying
on the public npm package, so the jar never needs to leave your own project.
import { UhfReader } from 'react-native-mendix-rfid-receiver';
const uhf = new UhfReader();
// Inventory scan (bulk read)
const sub = uhf.startInventory((tags) => {
// tags: [{ epc, rssi, count }, ...]
}, { power: 23 });
uhf.stopInventory();
sub.remove();
// Find tag by signal strength (radar/locate)
const findSub = uhf.startFind("E2003411A301B000AB120000", (update) => {
// update: { targetEpc, found, epc?, rssi?, count? }
}, { power: 23 });
uhf.stopFind();
findSub.remove();
// Write tag (EPC bank by default)
const result = await uhf.writeTag("E2003411A301B000AB120000", "1234567890ABCDEF", {
bank: 1, address: 4, password: "00000000"
});
// result: { success, attempts }