Skip to content Skip to sidebar Skip to footer

Nfc Mifare Ultralight Tags Writing

Any tutorial for how to write on Mifare Ultralight tags ? I have been searching for a while

Solution 1:

MifareUltraLight tags it contains 16 page and each page contains 4 bytes. Its first 4 page contains manufacturer info , OTP and locking bytes. After getting The Tag you can get MifareUltralight class using this:

MifareUltralight mifare = MifareUltralight.get(tag);

When you get the tag then before read and write into a page you must have to connect. When Connect successfully then using this Command you can write:

 mifare.writePage(pageNumber, pageData.getBytes("US-ASCII"));

here pageNumber is the page where you want to write and page data is Data that you want to write. pageData must be equals 4 bytes and page Number must less than 16. The Complete Code is here:

publicvoid writeOnMifareUltralightC( Tag tag,
        String pageData, int pageNumber) {
    MifareUltralight mifare = null;

    try {
        mifare = MifareUltralight.get(tag);
        mifare.connect();
        mifare.writePage(pageNumber, pageData.getBytes("US-ASCII"));

    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        try {
            mifare.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

}

You can also see the code sample From my repository

Solution 2:

You might want to look at this StackOverflow question:

Writing NFC tags using a Nexus S

Also, if you haven't done so already, read through the NFC Basics document on the Android developers' site:

http://developer.android.com/guide/topics/nfc/nfc.html

(Admittedly, there's not much documentation out there on this yet. If you get this working, I'd encourage you to write a technical blog post on your experiences!)

Post a Comment for "Nfc Mifare Ultralight Tags Writing"