Android NFC - ndef.writeNdefMessage() throws IOException and erases tag data
问题 My app uses the foreground dispatch system to allow a user to tap their NFC tag in order to perform a read-then-write operation on the tag. It works nicely if the user taps their tag properly (i.e., they tap it in the correct place on the phone and leave it connected for long enough), but if they physically remove the tag too early, then ndef.writeNdefMessage(...) throws an IOException. That means the write operation fails, which is fair enough. But the real problem is that the same failed