How can nfc.addTagDiscoveredListener()
accept 3 inputs, while in the code only two inputs are otherwise erroneous.
I add the solution above in the bottom function to read NFC identifiers, but it does not work.
This code is on the .ts homepage.
public onReadClicked(): void { function onNfc(nfcEvent) { var tag = nfcEvent.tag; var tagId = this.nfc.bytesToHexString(tag.id); alert(tagId); } function win() { alert("Listening for NFC Tags"); } function fail(error) { alert("Error adding NFC listener"); } this.nfc.addTagDiscoveredListener(win, fail); }
HTML side
<p> <button ion-button full (click)="onReadClicked()"> Read NFC Device </button> </p>
source share