New NFC features in Android

Posted on Feb 09, 2011 - By

Well, there are good news: Google announced an update to Android 2.3 that adds new NFC capabilities for developers. This update is a small feature release but finally adds read and write APIs for the near field communications chip. Other updates include new APIs for Bluetooth, graphics, media framework, and speech recognition. The new version is available as a downloadable component for the Android SDK.
Now, the plataform provides a new set of APIs supporting a wider range of standard tags, including:

  • NFC-A (ISO 14443-3A)
  • NFC-B (ISO 14443-3B)
  • NFC-F (JIS 6319-4)
  • NFC-V (ISO 15693)
  • ISO-DEP (ISO 14443-4)
  • Mifare Classic
  • Mifare Ultralight
  • NFC Forum NDEF tags

This release also provides a limited peer-to-peer communication protocol and API. As they say “advanced tag dispatching now gives applications more control over how and when they are launched, when an NFC tag is discovered. Previously, the platform used a single-step intent dispatch to notify interested applications that a tag was discovered. The platform now uses a four-step process that enables the foreground application to take control of a tag event before it is passed to any other applications (android.nfc.NfcAdapter.enableForegroundDispatch()). The new dispatch process also lets apps listen for specific tag content and tag technologies, based on two new intent actions — android.nfc.action.NDEF_DISCOVERED and android.nfc.action.TECH_DISCOVERED”.
We are going to test this new functionality, will be sharing our views about it and posting some new examples.

Tagged , .

11 Comments

  • Dominik says:

    That’s great to hear. Do you have any insight on wether or not the Nexus S supports sending and receiving extended length APDUs via ISO-14443?

  • Yes, in the new package android.nfc.tech they include the method “transceive(byte [])” in the NfcA class to send raw NFC-A (iso 14443-a) commands to the tag and receive the response. There are also specific classes for MifareClassic and MifareUltralight where you can send either raw commands via “transceive” or use classic commands (readBlock, writeBlock, increment, decrement) already implemented in the class.

  • Dominik says:

    Thanks for your answer. Just to be clear I’m particularly interested in extended length APDUs (i.e APDUs longer than 256 byte + Header) . Many NFC chips, including NXPs PN532, can only handle “normal” APDUs, that’s why I’m asking.

  • Sorry, I confused it with std APDUs commands. Well, in this update I don’t see a specific interface like ExtendedLength in the javacardx.apdu package. Maybe you should take a look at the NXP hal libraries because almost 99% of the NFC funcionality was already there since 2.3 release and now Google is updating the app and sdk layers for developers.

  • Gorka says:

    Hi,

    I see there is not DESFire specific support, but considering thay we can use the transceive method to send raw commands does it mean we could read a DESFire card if we now how to use the specification??

    Thanks.

  • Philipp Hug says:

    I did some experimentation with the Nexus S with the “transceive(byte [])” command and there seems to be a limitation that prevents you from using extended APDUs.
    In my tests the response from the smart card is longer than 256 bytes but the transceive method returns null.
    I haven’t debugged it yet but it looks like this is the problem…

  • nick says:

    hi,can nexus s itself be a tag which could be read by other machines, such as access control card reader?

  • F.C. says:

    Hi, does anyone have experience in establishing peer-to-peer communication between a NXP PN533 device (not Nexus phone) and a Nexus S phone with Android 2.3.3?

  • Eric Clamens says:

    Hi
    I’m french. We’ve developed an application for blind people. We’re looking for a command or source code to protect (but not permanently) our data in our tags. We would it to work like a p.i.n. : our application could read the data because of the pin ; we also could change the data in our tags because we know the pin.
    I would be great if you can help us.
    Bests regards.

  • Jaganlal says:

    Hi, can someone help me in reading Payment cards (like Chase Blink card – paywave, paypass cards). I looking at reading the card information like cc #, expiration etc. I did enuf research in getting APDU commands, but all in vain :(. Can somebody shed some lights? Please…. Thanks

  • Jaganlal says:

    I’m trying to Read Track data for Payment cards (PayWave, PayPass). As per my understanding they follow ISO 14443 B. With new NFC API,

    1. i can connect with IsoDep format without any exception thrown
    2. call getHiLayerResponse() – returns nothing :(. Now what?

    Later i tried to call transceive() method, but all in vain (i don’t know the APDU commands).

    Can someone help me how to read/get track details of PayWave or PayPass cards (payment cards)?

    if ( NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) ) {

    Parcelable nfcTag = intent.getParcelableExtra(“android.nfc.extra.TAG”);
    Tag t = (Tag)nfcTag;
    IsoDep myTag = IsoDep.get(t);

    String s1 = null, s2 = null;
    byte[] b1 = myTag.getHiLayerResponse(); //b1 is not null, but length == 0
    if( b1 != null && b1.length > 0 )
    s1 = new String(b1);

    byte[] b2 = myTag.getHistoricalBytes(); //returns nothing coz its NfcB
    if(b2 != null && b2.length > 0)
    s2 = new String(b2);

    if( !myTag.isConnected() )
    {
    myTag.connect();

    String sData = “0xBB”; // got this magic value from web
    byte []data = sData.getBytes();
    result = myTag.transceive(data);
    if(result != null && result.length > 0)
    {
    s3 = new String(result); // value of s3 will be “m”
    }
    }
    }

    Any help will be great, please shed some light… Thanks in Advance

Trackbacks and Pingbacks

Leave a Comment