Reputation: 127
When i scan with my iOS app a NFC-Tag i get this result:
04ea1b72835c80
i think this is the Uid.
Now i program with Flutter and the NFC-Manager package a NFC-Reader for Android. Now when i scan the same NFC Tag i get this Information:
{nfca: {identifier: [4, 234, 27, 114, 131, 92, 128], atqa: [68, 0], maxTransceiveLength: 253, sak: 0, timeout: 618}, mifareultralight: {identifier: [4, 234, 27, 114, 131, 92, 128], maxTransceiveLength: 253, timeout: 618, type: 2}, ndef: {identifier: [4, 234, 27, 114, 131, 92, 128], isWritable: true, maxSize: 492, canMakeReadOnly: true, cachedMessage: null, type: org.nfcforum.ndef.type2}}
i use this code in flutter:
void _tagRead() {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
var mytag = tag.data;
result.value = tag.data ;
NfcManager.instance.stopSession();
});
}
i tried to parse the identifier in different ways but i didn´t get the same result how from iOS.
Anyone know the right way?
Upvotes: 1
Views: 2367
Reputation: 127
This
void _tagRead() {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
var mytag = tag.data;
result.value = tag.data ;
NfcManager.instance.stopSession();
});
}
change to
void _tagRead() {
NfcManager.instance.startSession(onDiscovered: (NfcTag tag) async {
var mytag = tag.data["mifareultralight"]["identifier"].map((e) => e.toRadixString(16).padLeft(2, '0')).join(''); ;
result.value = mytag ;
NfcManager.instance.stopSession();
});
}
and i got 04ea1b72835c80
Upvotes: 2