0
votes

I am building a web application to read NFC tags using an ACS ACR1222L NFC reader. The application needs to respond by reading the NFC tag serial number whenever a tag is brought close to the reader.

I have read about the ascscm.jar for Android which has an onStateChangeListener. Using this the Android UsbManager detects the change in state from CARD_PRESENT to CARD_ABSENT and vice versa. However, I wasn't able to find a parallel to this in javax.smartcardio. Right now I am using a while(true) loop in my thread to continuously poll for checking if a card is present. I want to change this to an event driven approach using an eventListener so that my code reacts only when a CARD_PRESENT state is achieved and does not need to poll continuously.

1

1 Answers

0
votes

You are probably looking for something like waitForCardPresent(long timeout). You may still need a loop, but the thread will not be polling all the time (well, depending of the implementation of course, but it certainly is not supposed to poll).