questions - Question:NFC with NFC-Tools, Creating NDEF Application

I am attempting to do what I would have guessed would be pretty simple, but as it turns out is not. I have an ACR122 NFC reader and a bunch of Mifare Classic and Mifare Ultralight tags, and all I want to do is read and write a mime-type and a short text string to each card from a Java application. Here's what I've got working so far:

    I can connect to my reader and listen for tags
    I can detect which type of tag is on the reader
    On the Mifare Classic tags I can loop through all of the data on the tag (after programming the tag from my phone) and build an ascii string, but most of the data is "junk" data
    I can determine whether or not there is an Application directory on the tag.

Here's my code for doing that:


public static void main(String[] args){
        TerminalFactory factory = TerminalFactory.getDefault();
        List terminals;
            TerminalHandler handler = new TerminalHandler();
            terminals = factory.terminals().list();
            CardTerminal cardTerminal = terminals.get(0);
            AcsTerminal terminal = new AcsTerminal();
            NfcAdapter adapter = new NfcAdapter(handler.getAvailableTerminal(), TerminalMode.INITIATOR);
            adapter.registerTagListener(new CustomNDEFListener());
        catch(IOException e){
        catch(CardException e){
            System.out.println("CardException: " + e.getMessage());


asked Sep 13, 2013 in Core java by rajesh
edited Sep 12, 2013
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.