I have code from demo project (tmsweb_nfcdemoreader) and when I click "Start scanning" I can read serial number from the nfc card but when I click "Stop scanning" and after that "Start scanning" I get information "No application for NFC tag reading".
Summary
WebNFC1.Scan; <-- I can read serial from the NFC card
WebNFC1.Stop
WebNFC1.Scan; <-- I can't read serial from NFC card.
procedure TForm2.WebButton1Click(Sender: TObject);
begin
if WebButton1.Caption <> 'Stop scanning' then
begin
WebButton1.Caption := 'Stop scanning';
WebNFC1.Scan;
end
else
begin
WebButton1.Caption := 'Start scanning';
WebNFC1.Stop;
end;
end;
The error — "No application for NFC tag reading" — typically means that the browser or device you're using does not have any app or native capability registered to handle NFC tag reading requests made by the web application.
Why it happens:
When a web app tries to access the device's NFC reader (usually using the Web NFC API), the following can trigger this error:
Device doesn't support NFC: Not all devices have NFC hardware.
Browser doesn't support Web NFC: Currently, only a few browsers (mainly Chrome on Android) support the Web NFC API.
No NFC handler installed: Some systems expect a specific app or service to be installed/activated to handle NFC reading.
NFC is disabled: On Android, NFC has to be manually enabled in device settings.
Permissions not granted: If the user declines the NFC access permission, this could also trigger similar errors.
How to Fix or Handle It:
Make sure you're testing on Android with NFC enabled Use Chrome for Android (Web NFC is not supported on iOS) NFC hardware should be available and turned on
As I said ... the TMS Demo App (provided by TMS TMSWeb_NFCDemoReader) is open via Chrome and when I click "Start scanning" I'm able to read for example ASerialNumber but when you do this sequence:
WebNFC1.Scan; <-- I can read serial from the NFC card
WebNFC1.Stop
WebNFC1.Scan; <-- I can't read serial from NFC card.
after second WebNFC1.Scan I can't read the serial number. For me it is something with WebNFC1.Stop method which stop me reading nfc data after next WebNFC1.Scan.
Yes, I read it, but I don't experience any of the problems you described in your first response. Your demo application is working — but only until I call WebNFC1.stop() and then try WebNFC1.scan() again.
Let me explain everything from the beginning, including details about my environment:
NFC is enabled on my Android device.
I open the app in Chrome on Android (of course using a secure https context).
The web app has permission to access the NFC.
When I start reading NFC using WebNFC1.scan() and tap an NFC card, I successfully get the card's serial number — it works correctly.
When I call WebNFC1.stop(), the WebNFC reading is disabled — this is expected and works as intended.
But when I call WebNFC1.scan() again, I expect it to be ready for scanning. Instead, I get the message: "No application for NFC tag reading" — WHY???
I’ve attached a simplified version of your demo: TagReader.zip (2.5 MB)
.
Steps to reproduce the issue using my example program:
Click the "Start scanning" button.
Tap an NFC card — you should see a message like: "Serial number is: xxxxx".
Click the "Stop scanning" button.
Click "Start scanning" again.
Tap the NFC card once more.
Expected: "Serial number is: xxxxx"
Actual: "No application for NFC tag reading"
This is the issue I'm trying to understand — why does this happen?
Thank you, great ... btw maybe one more correction while we're at it... In the onReadingError event, there's no direct access to the actual error that occurred — we only have the Sender object. Maybe good idea will be add some AErrorMesage:string or something like that.
The OnReadingError maps onto the NDEFReader.readingerror event. It uses a generic Event object instead of anError or ErrorEvent, so we are not given access to the actual error message in any way. It's an experimental API so it can change in the future, something to keep an eye on.