Reputation: 11
Does anyone know about in Android NFC, how one phone can detect the type of other NFC devices including tag, another phone in P2P or another phone in Hosted Emulator Mode? In the code, the messages are all coming from the NdefMessage, does anywhere declare the the message is sent from which kind of devices?
Upvotes: 1
Views: 1302
Reputation: 40851
That depends on how you receive the NdefMessage within your app. For instance, if you receive it through an ACTION_NDEF_DISCOVERED
intent, there is a mandatory intent extra EXTRA_TAG
. Using the Tag
object passed in that extra, you can estimate what type of device was used to pass the NDEF message.
This method should permit you to clearly distinguish between messages received through peer-to-peer mode and from an NFC tag/smartcard/card emulation device. THe differetiation between an actual NFC tag (or contactless smartcard) and a device in card emulation mode will certainly be more difficult and will certainly require some extensive fingerprinting (e.g. a device that emulates NfcA and also supports peer-to-peer mode could be distinguished from an NfcA tag through its SAK byte which would typically indicate support for NFCIP-1).
Upvotes: 1