Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the Web NFC api be used in Progressive Web Applications?

I need to implement NFC (near field communication) in a PWA (progressive webapplication)

Every browser I have tested (Chrome MacOSX, Safari MacOSX, Safari iOS, Chrome for android) does not include the navigator.nfc object in navigator and it seems impossible to make use of this API: https://w3c.github.io/web-nfc/#conformance.

Is it possible to use NFC in any way in a PWA? Or do I have to develop a native application for this functionality?

like image 791
Stan Hurks Avatar asked Jul 02 '18 11:07

Stan Hurks


People also ask

Can PWA NFC?

When using PWA on Android, users can experience almost all native app features, including payment, NFC, fingerprint authentication, speech recognition, and more.

Can I use Web NFC?

In May 2021, Chrome for Android 91 came out - that and subsequent versions supports Web NFC – any web developer can experiment and use NFC from simple HTML pages (rather than an app). Apple's Safari and other browsers may provide limited support beyond Chrome (see this page for current test suite results).

What is NFC API?

The Web NFC API allows exchanging data over NFC via light-weight NFC Data Exchange Format (NDEF) messages. Note: Devices and tags have to be formatted and recorded specifically to support NDEF record format to be used with Web NFC.


1 Answers

Web NFC API is available only in Chrome for Android and that too when a flag is enabled(try about:flags) enabled.

Unless you are targeting your app for some internal corporate app where you can set the flag in all targeted users browser, I would recommend go with native code or wrapper(cordova or have a native app send in the details via web sockets)

This API is not making much progress since 2015 and so you can expect no magic to happen anytime soon. So don't rely on this API if you are targeting this for a critical app, especially when you cant control the end users browser settings.

like image 94
Anand Avatar answered Oct 07 '22 01:10

Anand