Closed semlette closed 4 years ago
Same issue. I need to read the id when tag is emty.
can't write too with the unformatted ndef
any solution ?? @semlette
I have opened pull request #24 which should improve support for empty tags, specifically allowing them to be read on Android and make it easier to check if they're empty using the new NDEFMessage.isEmpty
method.
I also found out that empty tags can be read on iOS 13 (already supported).
Please check out the PR and see if it fixes the issue for you guys.
your are amazing please update your README.md by example
@movieator does this work for you?
not yet to try, my phone bootloop.
yes this work, but with card formatted ndef. how to write empty and unformatted ndef ?
if (ndef == null) { // tag is not in NDEF format; skip! return; }
line 189 NfcInFlutterPlugin.java
why, skip ?
@hasanbasri1993 I've the "same" problem. I've brand new NFC Tags that are not formatted at all. I'd like to format them as NDEF on scan if they're not but I can't manage to do that.
If the tag is NDEF formatted there is no problem, I can read & write without problem, but I can't do anything if it's "blank".
hello @semlette, any solution for this ??
Do you think it's even possible to do something like that? I've read that iPhones only accept NDEF formatted code for reading.
Maybe that's possible to do something like: Scan the TAG => If TAG is recognized (NDEF) then do what you need => If TAG is unrecognized, then format it in NDEF, whatever's on it so after that we can do what we want with it.
Pushed 24c4adcd576fe6cbaf0a17dd90fe6df11c6563a8 to #24.
Tags that doesn't support the Ndef
technology, but does support the NdefFormatable
technology will now be sent to Flutter.
Note that if the tag does not support the Ndef
technology, there is absolutely no way to retrieve the ID from the tag.
Thanks a lot :) Will test it this afternoon.
Yes, in my case the tags are NdefFormatable, they're just brand new so there is simply "nothing" on them, and I guess a lot of people are in this case.
Just tried it, works like a charm for reading :)
However, when writing on a "virgin" tag, I've this error (no error when writing to an already NDEF formatted tag):
E/flutter ( 1788): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(IOError, write to tag error: null, null)
In my case getting the UID is enough, but if it's possible to format "virgin" tags to NDEF automaticaly when the format is unknown, I think that'd be a cool feature.
Thanks again for your work.
Pushed eda624256c41887a85398667839b9d46ee26de92 to #24.
The documentation for NdefFormatable.format()
states it must not be called on the main thread. So I have subclassed AsyncTask
to FormatTask
where NdefFormatable.format()
will be called.
I have successfully formatted 2 fresh tags that supported NdefFormatable
and not Ndef
.
However I have ran out of tags that support NdefFormatable
so I will not be able to test this any further.
I am going to merge #24 and close this issue since #24 fixed it. If there is a problem, I will reopen the issue.
iOS' API doesn't allow to read empty tags but Android's does. Fixable on Android.