Can you tell me please what is the difference between NDEF (NFC Data Exchange Format) and APDU (Application Protocol Data Unit).
I have developed an Android application that reads NDEF messages, and I want to know if it can work for APDU data too.
Application protocol data units (APDUs) are special communication units that are used when exchanging data with a Type 4 Tag platform. Command APDUs (C-APDUs) are the commands sent from the NFC reader, while response APDUs (R-APDUs) are the responses to a specific command received by NFC reader from the tag.
To read the NFC tag, the app needs to register for handling ACTION_NDEF_DISCOVERED intent. Registering this intent will let your app handle any NFC tag that is tapped to the Android device. If you wish to handle only those tags that belong to your application then you can add a filter.
APDU is a command response protocol for invoking functions executed on a smart card or similar device. In essence, the command consists of a 4 byte header followed by up to 255 bytes of data. The response contains a 2 byte header followed by up to 256 bytes of data.
To get access to the NFC hardware, you have to apply for permission in the manifest. If the app won't work without NFC, you can specify the condition with the uses-feature tag. If NFC is required, the app can't be installed on devices without it and Google Play will only display your app to users who own a NFC device.
NDEF is a wrapper format that allows you to package a data payload together with meta information (such as a data type identification), and that permits combining multiple such packages (so-called "records") in one "message" that can be stored on NFC tags and transfered across an NFC link.
NDEF itself does not define how such data (messages) should be exchanged between NFC devices (i.e. it does not define the communication protocol and commands to read or store such data).
APDUs are the command and response packets for communication with smartcards. A command APDU consists of an instruction code and associated parameter data. A resonse APDU consists of response data and a response status code (in response to a preceding command APDU).
NDEF is data container for storing structured data on NFC tags and transfering such data over peer-to-peer links while APDUs are commands and responses of a communication protocol for smartcards.
With NFC Forum Type 4 tags, APDU commands (like READ BINARY and STORE BINARY) are used to read and store NDEF data into a file on that tag type. Other NFC Forum tag types do not rely on APDUs but use other command sets.
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