Nfc Manager
class NfcManager
Manages the Android NFC foreground dispatch lifecycle for EidKit sessions.
Attach to your Activity's lifecycle to receive card tap events:
class MyActivity : ComponentActivity() {
private val nfcManager = EidKit.nfcManager()
override fun onResume() { super.onResume(); nfcManager.enableForegroundDispatch(this) }
override fun onPause() { super.onPause(); nfcManager.disableForegroundDispatch(this) }
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
nfcManager.handleIntent(intent)?.let { isoDep -> startSession(isoDep) }
}
}Content copied to clipboard
All dispatch is scoped to the foreground activity — the system will not deliver NFC tags to other apps while your activity is in the foreground.
Functions
Link copied to clipboard
Disable foreground NFC dispatch. Call from Activity.onPause. Safe to call even if NFC is unavailable — no-op in that case.
Link copied to clipboard
Enable foreground NFC dispatch for the given activity. Call from Activity.onResume.
Link copied to clipboard
Extract an IsoDep tag from an NFC intent delivered to Activity.onNewIntent.
Link copied to clipboard
Returns true if the device has NFC hardware and it is currently enabled.