The attachments are the new version of NFC library and a sample application. I added some extra java code to the library by Sherlok and Erel.
Here's how to use the lib:
1.initialize a "MiFare" object.
2.Call ReadSector() method with 3 parameters: SectorIndex, KeyData, KeyType
3.If succeeded, retrieve the data block by block with method GetBlockData()
Sub Read()
Dim key(16) As Byte
Dim block_data() As Byte
Dim bc As ByteConverter
Dim i As Int
For i = 0 To 15
key(i) = 255 '0xff
Next
'btnClear
Dim mfc As MiFare
Log("Check if the card is MF classic")
If NFC.IsMifareClassic(Activity.GetStartingIntent) Then
Dim StrData As String
mfc.Initialize(Activity.GetStartingIntent)
If True = mfc.ReadSector(0,key,0) Then' Read sector 0, key, type 0(as keyA)
Log("Read sector done")
For i = 0 To 2 'read 3 blocks of data
block_data = mfc.GetBlockData(i)
StrData = bc.HexFromBytes(block_data)
Log( "data:" & StrData)
If i = 0 Then
Label1.Text = StrData
Else If i = 1 Then
Label2.Text = StrData
Else If i = 2 Then
Label3.Text = StrData
End If
Next
End If
End If
End Sub
In manifest editor, I added "android.nfc.action.NDEF_DISCOVERED" and "android.nfc.action.TAG_DISCOVERED" intent filter. Actually "android.nfc.action.TECH_DISCOVERED" is better than NDEF_DISCOVERED but it needs some code like:
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/filter_nfc" />
I don't know how to put the "filter_nfc.xml" under "res/xml" directory. Maybe Erel knows.
Good luck