I want my android device to act as NFC tag. Is it possible to use NFC device as NFC tag? How can I achieve that? I have done read/write tag, beam data between devices.
Depending on your NFC device, this may be possible. However, I do not agree with kamituel that this is being done by multiple applications through Android Beam.
Android Beam uses NFC's peer-to-peer mode which (while it may have a similar effect) is not the same as using one device as a reader (reader/writer mode) and one device as a tag. Peer-to-peer mode uses a different protocol stack for communication than reader/writer mode. I.e. NDEF on top of SNEP on top of LLCP for peer-to-peer mode communication and NDEF on top of one of the Tag Operation specifications for reader/writer mode accessing NFC tags.
So only the data presentation layer (NDEF) is the same for both protocol stacks. In an NFC environment, the NDEF (NFC data exchange format) abstracts the actual communication part and could potentially make applications independed of the used data transport. Android just somewhat failed to make this usable by introducing their Beam UI.
If the NFC device that you want to emulate a tag with is an Android device, you have some requirements and limitations when it comes to emulating an NFC tag:
In parallel to the HCE capabilities an Android device will also announce its peer-to-peer mode capabilities to other devices. As a consequence, if you want to access an Android HCE emulated NFC tag with another Android device, this other Android device will instead see the peer-to-peer mode capabilities and won't automatically process NDEF messages from the emulated tag.
In order to overcome this limitation, the reading Android device would also need to have Android 4.4 or later. Starting with that platform version, you can disable peer-to-peer mode discovery by using the reader mode API. Only when you do that, you can access the emulated NFC tag from the second Android device.
Yes, it is possible. This is being done by multiple applications. One example is a browser app, which will cause the peer device to open the same page. By doing that, browser causes the peer device to behave virtually the same way as when reading the passive NFC tag.
The key is to send the valid NDEF record to the peer device. For instance, to make a peer device open a browser with the given URL, you could use the following record:
You can see that values of the NDEF record fields vary depending on what content you want to serve. The well known ones are URI's (as shown above), text records, smart posters etc.
See NdefRecord class for reference.
[1] NFCForum-TS-NDEF_1.0
[2] NFCForum-TS-RTD_URI_1.0
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