We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this questionAny tutorial for how to write on Mifare Ultralight tags开发者_JAVA技巧 ?
I have been searching for a while
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:
public void 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
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!)
精彩评论