This question has been asked couple of times but it still doesn't have a clear answer. According to this question, the reason is because of transceive timeout. Some developers filed an issue about this but I don't see any clear solution on the thread.
I'm trying to write in NTAG216 using MifareUltralight class. I'm using writePage
method, and that's where the error occurs.
This is part of the error report:
Error: java.io.IOException: Transceive failed at
android.nfc.TransceiveResult.getResponseOrThrow(TransceiveResult.java:52)
at android.nfc.tech.BasicTagTechnology.transceive(BasicTagTechnology.java:173)
What I have tried so far:
Test devices where writing to tag works:
Test devices where writing to tag doesn't work:
As you can see, one 4.4.2 version works, and the other one doesn't work. (Note that I have password in the tag and I am successfully authenticating)
What I know so far is that this is a hardware issue. But I once used writeNdefMessage
method and those devices can write to the tag. I just switched to tranceive method because I'm password protecting the tag.
According to this thread's answer, it might be because the phone's nfc capacity couldn't handle the tag's power requirement. But as I mentioned before, I was using writeNdefMessage
and it was working, so power requirement is out of the question.
Note: Reading contents of tag works using read command (byte) 48
even though writing (byte) 162
gives an error.
The main problem is that the phone is too slow. So to solve the problem, you have to refactor your code such that it will be faster.
What I did was create several threads for parallel computing.