How to create Host-based card emulation android application - tags

I am trying to create an android HCE application to emulate an NFC tag.
By following https://developer.android.com/guide/topics/connectivity/nfc/hce, I successfully create an app to send and receive APDU command. However, it just worked when we use own reader app. When using other NFC reader app, I found that processCommandApdu(byte[] apdu, Bundle extras) didn't work, so we cannot emulate NFC tag.
So anyone can tell me how to create an HCE app that can be read by other NFC reader. Thanks

Related

share a text between two mobile devices using Flutter NFC

I'm trying to configure NFC in flutter and find a Near by Device using it and while tapping the two devices the text Message should be shared from one device to Another
couldn't able to find any Perfect Example or a Tutorial regarding my requirement any docs or sample code will be really helpful
To share a text between two mobile devices use Flutter NFC, you can use the flutter_nfc_kit package, which provides a simple and easy-to-use API for working with NFC in Flutter.
**ExampleCode:
Add the flutter_nfc_kit package to your dependencies in your pubspec.yaml file.**
**Initialize the NFC module in your main function:
NFC.instance.start();
NFC.instance.share("Your message here");
**NFC.instance.onShareSuccess.listen((event) { print(event.shareData); });
NFC.instance.isAvailable**

Flutter windows app wanting to detect the NFC reader connected via USB

Hello everyone I am new to the community (Flutter community) and I want to build an app where basically my Windows app will interact with an NFC tag reader/writer that will get connected to my laptop via USB. So when the NFC reads a tag, the code must get transmitted to my app and vice-versa if I want to write something to a tag I have to be able to do it using the windows app and send the code to the NFC reader writer that will write that data to the tag.
My question is: does anyone implemented something like this or a plug-in or something that allows me to connect the NFC reader to the windows app?
Thank you in advance.
NFC related development SDK.
https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/_nfpdrivers/
Here is a project about NFC Class Extension that you can check out.
https://github.com/microsoft/NFC-Class-Extension-Driver

How to exchange data and files between two devices by NFC using Flutter?

I am a flutter developer, I want to make an application to exchange messages and files by using NFC technique
I used nfc_in_flutter plugin for reading and writing NFC tags but I don't know how to send and receive data and files between devices by using NFC in flutter.
Could any one help me, please?
Generally you don't try and send data between 2 devices using NFC, there is a standard for it, but most devices don't support it (it has never been supported on iOS and Android has dropped support for it as it was unreliable)
Use Bluetooth or Wifi Direct instead.
Update:
If you have to use NFC then the nfc_in_flutter plugin is no use, you are going to have to call native code for each platform yourself / write your own plugin.
And for 2 iOS devices, then forget it, just not possible because of what the OS supports.
When one device is an Android there is a complicated method that some people have had some success with but it still has it's issue.
The Android device does Host Card Emulation (HCE) and pretends to be a really Type 4 NFC tag, then other devices can read/write to it as if it were a real Tag which both iOS and Android Support. BUT on older Android devices then the deprecated Android Beam might get in the way and you would need to use enableReaderMode to do the read/write on Android.
You will need to put in a lot of error handle in the read/write App as NFC comms is very slow and very prone to loosing the connection, so it would have to handle loosing the connection and restarting where it last successful read from/written to.
All these problems make this extremely difficult to achieve a workable solution and was the main reason Google removed Android Beam for Android to Android sharing (which does use a NFC peer to peer protocol)

Writing NFC Card

I am using flutter to build my application to read and write the NFC cards I am using the flutter plugin NFC reader to read the cards but I couldn't find any way to write the NFC​ cards.
You can't write NFC tags on ios where in android you can.
You might wanna use Platform channels.
Platform channels helps writing and communicating between platform-specific code and your Dart code
Here is a medium post regarding writing an NFC tag on android
Write it on android and connect it to dart using Platform channels

Clone an NFC Mifare Card (ISO 14443-3A) into my Flutter app

I have an NFC card from my city public transport, and I want to integrate in my Flutter app a feature that clones the data from the card and use the app instead of the card.
Here is a link to my open source app (it is still WIP). It is for the students in my faculty and I want to integrate this freature in this application.
I don't know how to get the data from the card in Flutter and send it when the phone is next to a NFC receiver (like those from buses).
By clone, I assume that you'd like to use your mobile device as the NFC card. What you can do here is copy the NFC tag's metadata using flutter_nfc_kit plugin then implement a NFC emulator using nfc_emulator to have your device act as a NFC tag. Note that NFC emulator only supports Android at present.