TNR
TNR

Reputation: 5869

how to write data into MifareClassic Tags?

I am very newbie to NFC Android. Now I am doing Project on NFC which has to Write NFC Tags with secured Data. So here My app should support all forum tags and MifareClassic, Mifare Unltralight Tags. I got a sample from tapintonfc blogspot and which is working for all nfc forum tags but not with the MifareClassic. So I found in the documentation writing data in MifareClassic Tag. I Understood that MifareClassic contains Sectors and each Sector has 4 blocks in which one block is used to store keyA,keyB for authentication. So My doubt is Can i store contactData and call/sms data into a single MifareClassic Tag. if yes, how?. My second doubt is if Card will store one data (either contact or call/sms) at a time, then if my contact data is of 400bytes then how to store it in the sectors. It is clear that we can use 48bytes of space per sector. Please some one clear my doubts.

Thanks in Advance

Upvotes: 2

Views: 3277

Answers (1)

noni
noni

Reputation: 2947

You can push data into MifareClassic Tags using NFC Advanced API.

There are two ways for pushing data:

  • NDEF Messages (High level way): I recommend this method to push Contacts VCARDs or data like that. NDEF messages are already defined to push those type of information

  • Sending data as APDU Commands, which are encapsulated by Google in their API, but this way requires understanding of MifareClassic memory structure (Sectors, Blocks, authentication of each block, 16 bytes for block and the 4th block for configure accesing to the sector): You have to manage byte by byte the information that you want to store in the Mifare

To push NDEF Messages (the easist way), I recommend you to read this guide: http://developer.android.com/guide/topics/connectivity/nfc/advanced-nfc.html

To push data using APDU commands read this: http://www.nxp.com/documents/data_sheet/MF1S503x.pdf

After understanding that PDF, you will understand how to use NFC low level API

Upvotes: 4

Related Questions