I've found that Android devices support three NFC modes: reader/writer, P2P, and card emulation.
Is it possible for my app to check which mode is currently enabled?
You can check for NFC settings on your Samsung Android device by looking in the settings app > connections > tap NFC and contactless payments. If you see an option for NFC there, your device is enabled to make NFC payments.
Physical TestingSmall quantities of NFC tags can be tested by manually using an NFC enabled mobile device and an app such as the GoToTags Android App or GoToTags iOS App. For larger quantities of NFC tags, setting up a testing station using the GoToTags Windows App and an NFC reader might be more appropriate.
The majority of new Android smartphones have an NFC chip in the phone. Your phone's NFC chip (and Android Beam) needs to be activated before you can use NFC: Go to Settings > More. Tap on the NFC switch to activate it.
Turning NFC On and Off Once you have determined if your device supports NFC, it's important to understand how to turn the feature on and off. Depending on the manufacturer, it's possible your device supports NFC but, by default, came with it switched off in the settings.
No, your app can't really check what mode is currently enabled. The point is that, by default, an Android device will periodically check for all three modes (actually it's a bit more complicated than that: those three modes are themselves split into several parts, each polling for a certain technology). So, while the screen is on, you can expect the Android device to cyclically switch between listening for other readers and polling for different types of tag technologies and peer-to-peer mode devices. This is the case regardless of whether you registered to send a message over peer-to-peer mode, an app is registered for HCE, or your app registered for NFC discovery intents. Even if you disable Android Beam in settings, the device will remain to poll for peer-to-peer mode.
Only if you explicitly disable card emulation and P2P using the reader mode API (available on Android 4.4+), your app can control that only reader/writer mode is active (and it can even control which tag technologies should be polled for).
So your app can know what modes it enabled itself and can do some guessing, e.g.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With