lube / nfc-react-native

69 stars 35 forks source link

Not receiving onTagDetected on Android 4.4 #12

Closed ahenager closed 7 years ago

ahenager commented 7 years ago

This library is working perfectly for me for reading tags on Android 5.x+, but I am not receiving the event on Android 4.4. I am not getting an exception at any point, or any other indication of something going wrong. The device on which I am testing will chime when an NFC tag is read, but I'm not even getting the chime with my app. I'm using the recommended settings for my manifest on React Native 40.0.

Below is a snippet of what I'm doing. emitter is an event emitter in my app that I use to publish various factors for identification.

function convertIntToHexId(tagInteger) {
  return tagInteger.toString(16).replace(/(.{2})(?!$)/g, "$1:");
}

getTagId();

DeviceEventEmitter.addListener('onTagDetected', (e) => {
  emitter.emit('factorReceived', {factorType: 'nfc', key: convertIntToHexId(e.id)});
});
ahenager commented 7 years ago

There was a problem with the NFC service on this particular device.