android - 如何在 android 中使用 MifareClassic API "Increment"和 "Decrement"?

标签 android nfc increment mifare

我的问题是当我调用 MifareClassic 函数“increment”时,它会返回“Increment success”,但是当我检查值 block 时,它没有任何值的增量,是否有任何错误使用我的代码?

我的代码如下:

   try {
     mfc.increment(0x14,increvalue);
     metaInfo =  "Increment Success !";
     mfc.close();
   } catch (IOException e) {
     e.printStackTrace();
     metaInfo = "Increment Fail!";
   }

最佳答案

mifare incrementdecrement 函数对标签进行计算,但不会将结果写回持久内存。

相反,结果将存储在标签上的临时寄存器中。

要将结果写回标签,请使用transfer 函数:

http://developer.android.com/reference/android/nfc/tech/MifareClassic.html#transfer%28int%29

请注意,您可以为增量和传输传递不同的 block 索引,以实现从 block X 中添加/减去并将结果写入 block Y 的函数。

关于android - 如何在 android 中使用 MifareClassic API "Increment"和 "Decrement"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11999710/

相关文章:

android - 查询整个媒体商店时获取 AUDIO_ID

android - Dagger 2.15 : Appcomponent - was unable to process this interface

android - NFC 上的 IntentFilter - Xamarin - C#

用 C 编写 NFC 芯片和其他 NFC 问题

android - 如何检查是否安装了拨号器应用程序?

android - 使用已使用的权限恢复额外的用户数据 android.permission.MANAGE_ACCOUNTS

ios - 在 iOS 13 上读取 Mifare Ultralight NFC 标签时出现 "Tag connection lost"错误

Javascript 基本自增和自减

java - 我的投票系统已经很好但是

c - 手动递增指针