Search code examples
ionic-frameworknfcnumber-formattinguniqueidentifierserial-number

Reading tag from Ionic NFC plugin gives different information than if I use reader


I am developing an Ionic 2+ application using the NFC plugin.

The issue I run into is how the tag is read differently by a simple USB reader and by the device. The tag IDs are different.

In Ionic I use:

this.nfc.bytesToHexString(event.tag.id)

It is read correctly and I log the result: ionic result

From USB reader I get: usb reader result

On the left is the software for the RFID reader, and on the right are reads with different settings.

What I need is to get the same information for both, the USB reader and the NFC plugin. I don't care about the format.


Solution

  • The IDs that you read are the same except that your USB RFID reader seems to only reads 4 bytes of the 7 byte UID. Since your USB reader doesn't seem to support any other formats, you won't be able to infer the remaining 3 bytes from nowhere. However, you can easily chop off the last three bytes of the UID in your ionic application:

    this.nfc.bytesToHexString(event.tag.id.slice(0, 4))
    

    You would then get the same value as for format "8 no. in HEX reverse".