My problem is when i called the MifareClassic function "increment", it will return "Increment success", but while i check the value block , it's doen't have any increment for the value , are there have any wrong using in my code ?
my code is as below :
try {
mfc.increment(0x14,increvalue);
metaInfo = "Increment Success !";
mfc.close();
} catch (IOException e) {
e.printStackTrace();
metaInfo = "Increment Fail!";
}
The mifare increment
and decrement
functions do the calculation on the tag but don't write the result back to persistent memory.
Instead the result will be stored in a temporary register on the tag.
To write the result back to the tag use the transfer
function:
http://developer.android.com/reference/android/nfc/tech/MifareClassic.html#transfer%28int%29
Note that you may pass a different block index for increment and transfer to implement a function that adds/subtracts from block X and writes the result into block Y.