I've a Mifare Classic1K NFC tag but I'm unable to write any content over it. Its writable but seems like it is not formatted in NDEF which is a pre-requisite for Android devices to be write data on it. Any suggestion is welcome.
P.S: I do have a TRF7960 RF Antenna if that can help to format it.
NDEF is a standardized data format specification by the NFC Forum which is used to describe how a set of actions are to be encoded onto a NFC tag or to be exchanged between two active NFC devices. The vast majority of NFC enabled devices (readers, phones, tablets…) support reading NDEF messages from NFC tags.
NFC Tags are rewritable by default. Potentially, the NFC Tag can be rewritten endlessly. They are guaranteed to be rewritten up to 100,000 times (depending on the IC). However, you can also block them, so that they will no longer be rewritten.
An NDEF record contains a payload of data and metadata describing how to interpret the payload. Each record's payload can be one of several different data types. The header for each record contains metadata describing the record and its place in the message, followed by its type and ID.
Given an android.nfc.Tag
object named tag
, to format it, use:
NdefFormatable formatable=NdefFormatable.get(tag);
if (formatable != null) {
try {
formatable.connect();
try {
formatable.format(msg);
}
catch (Exception e) {
// let the user know the tag refused to format
}
}
catch (Exception e) {
// let the user know the tag refused to connect
}
finally {
formatable.close();
}
}
else {
// let the user know the tag cannot be formatted
}
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