public interface NfcListener
Callback for long-running tag-discovery sessions registered via
Nfc.addTagListener(NfcListener). Unlike Nfc.readTag(NfcReadOptions)
– which resolves once and ends the session – a listener stays armed
and receives every tag the platform produces until Nfc.removeTagListener(NfcListener)
is called.
Useful on Android (foreground dispatch / reader-mode) where the tag
stream is naturally multi-tag. On iOS each tagDiscovered(Tag)
callback corresponds to a full Core NFC session that is automatically
re-armed.
Callbacks run on the EDT.
Methods
public abstract void tagDiscovered(Tag tag) | Called when a tag enters the field. |
public abstract void sessionFailed(NfcException error) | Called when the session ends because of an error. |
Method details
tagDiscovered
public abstract void tagDiscovered(Tag tag)Called when a tag enters the field. The tag is alive only for the
duration of this call plus any pending async transceives; after the
next system event it may report
NfcError.TAG_LOST.sessionFailed
public abstract void sessionFailed(NfcException error)Called when the session ends because of an error. After this fires
the listener is automatically removed; re-register it to resume.