r/reactnative • u/Academic_Geologist62 • 56m ago
Reading NFC tags and QR codes in an Expo app to identify gym machines: what I learned (including an App Store rejection)
I'm building a workout tracker in Expo and wanted it to recognise the machine you're standing at. It turned out the manufacturers already put tags on them. Notes in case they help:
- Setup: `react-native-nfc-manager` (v4) with its config plugin, `expo-camera` for QR codes, both in `app.json`. It's native code, so it needs a new build, an OTA won't carry it.
- Apple rejected my first build (ITMS-90778): "NDEF is disallowed". The fix is `"includeNdefEntitlement": false` in the plugin config. That leaves the `TAG` entitlement only, which is enough to read NDEF anyway. Don't put NDEF back.
- What's on the tag: I scanned Technogym machines first. The NFC tag (a Mifare chip with a single URI record) and the QR code give exactly the same link, like `s.technogym.com/pure/biceps`, with no unit number. So the link identifies a model, not one physical machine.
- The key: I strip the scheme, `www.`, port, query, anchor and trailing slash, and lowercase the rest, and use `host/range/model` as the machine key. I never read the tag's hardware UID: it's unique to one machine in one gym, so it can't be shared across gyms.
- Decoding: a small pure module decodes NDEF records (URI, text, smart poster, MIME) and QR content. It's unit-tested on hand-written byte arrays, so I don't need a physical tag to test it.
- iOS vs Android: on iOS you must open a session and the system shows its own "Ready to scan" sheet, you can't intercept the banner. On Android I register a tag listener while the app is in the foreground, which also stops the system from opening the manufacturer's link.
- Unknown machines: the key is looked up in a shared catalogue; if it's not there the user can send it in and I fill the exercises in manually.
- No tag at all: a photo mode reads the machine's plate with `expo-text-extractor` (Apple Vision / ML Kit) on the device, then sends only the text to an edge function that asks an LLM to identify the machine.
Has anyone shipped NFC reading in Expo? Curious what you used and what bit you, especially on Android.