Search Results for

    Show / Hide Table of Contents

    Explanation: ownership

    Purpose: explain why only one session and one connection can own the NFC hardware at a time. Platforms: Android, iOS. Status: stable.

    One owner, never replaced

    The NFC controller is a single, shared resource. On Android, reader mode and foreground dispatch change how the controller behaves for the whole device while they are active; on iOS, Core NFC allows one reader session that the system presents as a sheet. Two parts of an app that both believe they control scanning would see tags disappear, prompts change or sessions end unexpectedly.

    The library therefore has one coordinator per app. It grants ownership explicitly:

    • StartSessionAsync returns an owned INfcScanSession or a typed failure. A competing start returns Busy; it never silently replaces the current owner.
    • Within a session, one tag connection is active at a time across all protocol views, raw technologies and native access. A competing open or command returns Busy instead of queuing.
    • Disposing the session or connection releases ownership; await using makes the lifetime visible in code.

    Owner and window lifecycle

    Event Android iOS
    Who owns the hardware The resumed activity; with several windows, the most recently resumed one. The Core NFC session, which owns the system sheet.
    Start before the owner is ready The session is reserved and visible as Starting through INfcSessionCoordinator.CurrentSession, bounded by NfcIntegrationOptions.ActivationTimeout (30 seconds by default, session.owner.timeout). Not applicable: the sheet opens on start.
    Pause The session is suspended and native ownership released. Not applicable.
    Resume The session is activated again with a new native generation; stale callbacks from the old activation are ignored. Invalidation by the system is final: the library does not reopen a sheet, because a new session needs a new user action.

    Tags are lifetimes, not identities

    Each accepted discovery gets a new opaque Id, even for the same physical tag. A snapshot is data, not a connection, and a UID cannot revive an expired discovery. Stop, pause, reconfiguration or a new discovery invalidate the previous handle; operations on it return InvalidTag, SessionEnded or TagLost and are never redirected to another tag.

    What this means for your app

    • Keep one scanning workflow per screen and dispose sessions when the workflow ends.
    • Treat Busy as "someone else owns the resource", not as a hardware failure.
    • Await each command on a connection; do not run them concurrently.
    • After tag loss, ask for a new tap instead of retrying on the old handle.

    Related

    • Quarantine: what happens when ownership cannot be released.
    • Cancellation: how cancellation interacts with ownership.
    • Result and lifetime types: contracts.
    • Edit this page
    In this article
    Back to top Nementis MAUI NFC documentation