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?