2

I'm using the J2ME contactless API (JSR257 - javax.microedition.contactless.*) to read smartcards on a Nokia phone. The following code works just fine and the targetDetected method is called as expected when I put a card on the phone:

DiscoveryManager dm = DiscoveryManager.getInstance();
dm.addTargetListener(this, TargetType.ISO14443_CARD);

public void targetDetected(TargetProperties[] tps) {
   logger.log("found card!");
}

However, I'm wondering if there is any way to get a callback when the card is removed? Or is the only way to check if the card has been removed to try and open or read from a connection and catch the appropriate exceptions?

Charles
  • 50,943
  • 13
  • 104
  • 142
Josef Pfleger
  • 74,165
  • 16
  • 97
  • 99

0 Answers0