I am using react-native-nfc-manager to make an app which scans NFC tags for iOS & Android. Both parts work which is good but not on all devices. For example:
Working devices:
iPhone 17 Pro Max
Samsung Fold Z5
OnePlus 7 PRO
Not working devices:
Samsung S24
Samsung S20 FE
This piece of code listens to tags being scanned on the background so that the user does not need to press a button constantly:
useEffect(() => { if (Platform.OS !== "ios" && isNfcAvailable) { let isActive = true; NfcManager.setEventListener(NfcEvents.DiscoverTag, async (tag: TagEvent) => { if (!isActive) return; showNFCScreen(); if (tag?.ndefMessage?.[0]) { ... } else { setNfcScanError(1); } }); NfcManager.registerTagEvent(); return () => { isActive = false; NfcManager.setEventListener(NfcEvents.DiscoverTag, null); NfcManager.unregisterTagEvent(); }; } }, [isNfcAvailable]);
Example of tag value:
{"id": "0800B00B", "techTypes": ["android.nfc.tech.IsoDep", "android.nfc.tech.NfcA"]}
While holding the not working devices near the tag, it simply will not get read for some reason.