semlette / nfc_in_flutter

Cross-platform flutter plugin for reading and writing NFC tags. Not maintained anymore - not looking for new maintainer, fork instead.
MIT License
120 stars 119 forks source link

Tap To Connect functionality #16

Closed svsobh closed 4 years ago

svsobh commented 4 years ago

Hello Andi! Great work on the plugin man. I sent you an email as well, and am posting this question here in case someone else is wondering this too.

How do we create a tap to connect like functionality with nfc_in_flutter, and read/write ndef tag usage?

Detailed Use Case: Two users have the same screen open on the same app, on their respective phones. As soon as they tap their phones, both of them see a success message stating that they are now friends. I went through the example code you have provided, but I simply can not understand how to implement this functionality. Is it even possible with flutter?

semlette commented 4 years ago

Hi, thank you for the kind words.

"Tap to connect" functionality is possible to do with NFC, but it may be difficult.

Phones do not have a built-in NFC tag, so you can't "just read" another phone. However if you emulate a tag on the phone's NFC chip, you can read from that phone. This is called host card emulation. Both iOS and Android can read emulated tags, however only Android can emulate tags.

nfc_in_flutter does not have functions to emulate tags, so you would have to research how to emulate tags on Android, and then communicate with Flutter using a Platform channel.