Use NFC device as NFC tag

I want my android device to work as an NFC tag. Can I use an NFC device as an NFC tag? How can I achieve this? I made a read / write tag, beam data between devices.

+3


source to share


2 answers


This may be possible depending on your NFC device. However, I disagree with kamituel that this is done by multiple apps via the Android Beam.

Android Beam uses NFC peer-to-peer mode, which (although it may have a similar effect) is not the same as having one device as a reader (read / write mode) and one device as a tag. Peer-to-peer mode uses a different protocol for communication than read / write mode. That is, NDEF over SNEP over LLCP for peer to peer communication and NDEF over one of the Operation Tag specifications for read / write mode accessing NFC tags.

Thus, only the presentation layer (NDEF) is the same for both protocol stacks. In an NFC environment, NDEF (NFC Data Exchange Format) abstracts the actual part of communication and can potentially make applications regardless of the data transport used. Android just couldn't make it useful by introducing its Beam UI.

If the NFC device you want to emulate the tag with is an Android device, you have some requirements and restrictions related to emulating an NFC tag :



  • The emulation device must be running Android 4.4 or newer.
  • The emulation device must support host-based card emulation. This does not apply to many devices with NXP PN544 NFC controller.
  • You can only emulate an NFC tag according to the NFC Forum Type 4 tag specification. This is due to a limitation in Android HCE that allows emulation of IL / IEC 7816-4 application structures on top of ISO / IEC 14443-4.

In parallel with HCE capabilities, an Android device also announces peer-to-peer capabilities to other devices. As a consequence, if you want to access an emulated NFC tag from Android HCE with another Android device, that other Android device will instead see peer-to-peer capabilities and will not automatically process NDEF messages from the emulated tag.

To overcome this limitation, you will also need Android 4.4 or newer to read an Android device. Starting with this version of the platform, you can disable peer mode discovery using the read mode API . Only when you do this can you access the emulated NFC tag from the second Android device.

+5


source


Yes it is possible. This is done by several applications. One example is a browser application that will cause a peer device to open the same page. In doing so, the browser forces the peer device to behave in much the same way as when reading a passive NFC tag.

The key is to send a valid NDEF record to the peer device. For example, to make a peer device open a browser with a given URL, you can use the following entry:

  • TNF: well known (0x01, according to [1])
  • type: 'U' - (0x55, according to [2])
  • Payload: URL - usually UTF-8 encoded, with possible acronyms (see [2] for description)
  • id: null (you can add some value here, but this is not necessary)

You can see that the field values ​​of the NDEF record differ depending on what kind of content you want to serve. Known are URIs (as shown above), text posts, smart posters, etc.



See the NdefRecord class for a reference.

[1] NFCForum-TS-NDEF_1.0

[2] NFCForum-TS-RTD_URI_1.0

+1


source







All Articles