I have been searching and googling for how NFC works with mobile apps , but I was not able to get the whole picture . I want to make an NFC based Device with Arduino , something like this :
https://arduinogetstarted.com/tutorials/arduino-rfid-nfc
so basically I want my app to be able to communicate with my Arduino so when my mobile is close to it it will identify it and do something based on my code .
I have heard of many packages on pub like : nfc_manager
to help me achieve that .
my extra question is there is something i can do to make the app only recognize the Arduino NFC reader that i made ?
CodePudding user response:
Looks like you can't, but you can make assertion on the tag technology and only execute logic if the tag tech is the same as the one you put on your arduino
From the article you post, it looks like your tag is a MiFare tag. So you can use this static method of the MiFare class :
static MiFare? from(NfcTag tag) => $GetMiFare(tag);
The result of this is a nullable MiFare object, so in your code you can do :
tech = MiFare.from(tag);
if (tech is MiFare) {
// enter code here
}
You can also check that
tech != null
is true
This make your app only look for the same kind of NFC tag as the one you have. If you want more fine grain control, you might want to make some assertion on the data of the tag.