nfcIsEnabled
Determine if the Near-Field Communication (NFC) is enabled.
🔑 Minimum required license level: Core.
Sample usage
try {
val networkDiagnostic = rasp.diagnostic.network
val nfcIsEnabled = networkDiagnostic.nfcIsEnabled()
Log.d("RASP-DEMO", "[networkDiagnostic] nfcIsEnabled: $nfcIsEnabled")
} catch (e: Exception) {
Log.e("RASP-DEMO", "[networkDiagnostic] nfcIsEnabled error: ${e.message}")
}
Content copied to clipboard
To observe changes of the NFC check you can use the observe() method.
val modelNetwork = rasp.watcher.network.observe()
launch {
networkModel.nfcIsEnabled.collect { detected ->
if (detected != null && detected) {
Log.d("RASP-DEMO", "[nfcIsEnabled] $detected")
}
}
Content copied to clipboard
Return
Boolean
— true if NFC is currently detected.