Interface NfcListener
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidsessionFailed(NfcException error) Called when the session ends because of an error.voidtagDiscovered(Tag tag) Called when a tag enters the field.
-
Method Details
-
tagDiscovered
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 reportNfcError.TAG_LOST. -
sessionFailed
Called when the session ends because of an error. After this fires the listener is automatically removed; re-register it to resume.
-