Reputation: 31
I am creating an App for NFC HCE in Flutter. I want to notify the user when NFC is disabled from device settings.
I have tried platform channel to detect this, but when I turn off NFC from settings, then it claims that NFC is not supported, even when my device does have NFC.
My methods:
private fun Context.isNfcAvailable(): Boolean {
return NfcAdapter.getDefaultAdapter(this) != null
}
private fun Context.isNfcEnabled(): Boolean {
val nfcAdapter = NfcAdapter.getDefaultAdapter(this)
return nfcAdapter?.isEnabled ?: false
}
Upvotes: 0
Views: 245