Reading memory of nfc using Ionic

Viewed 32

Im attempting to read the memory of a nfc chip using an ionic app. I installed phonegap-nfc for doing so.

I set up the device to read the nfc as soon as the page is loaded and log the content.

  ionViewDidEnter() {
   const flags = this.nfc.FLAG_READER_NFC_A;
    this.nfc.readerMode(flags).subscribe({
       error: err => console.log('Error reading tag: ', err),
       next: tag => {
         console.log('data: ', JSON.stringify(tag));
         console.log(({tag}));
         tag.ndefMessage.forEach(data => )
           console.log(this.nfc.bytesToHexString(tag.id));
         },
     });
  }

The Data im getting:

{
  "id": [
    4,
    100,
    -53,
    26,
    76,
    61,
    -128
  ],
  "techTypes": [
    "android.nfc.tech.NfcA",
    "android.nfc.tech.MifareUltralight",
    "android.nfc.tech.NdefFormatable"
  ]
}

In a different stackoverflow post I found out that the memory can be read using the tag.ndefMessage property. However for me that property is always undefined.

Am I missing some kind of permission to read the memory of the nfc in the App?

I also downloaded NFC Tools for my Android phone and read the memory using that app which worked fine. So im sure that its not a bad nfc chip

0 Answers
Related