Can PWA access android's NFC capabilities - in 2019?
Asked Answered
M

3

6

We are developing PWA for our app because it's capable of 99% of our needs , however we do need NFC reading capabilities (not writing) and we would hate to abandon PWA and go Native just for this 1 thing

Our purpose for NFC is for reading the serial only. In fact we dont need fancy NFC functions. We just have a text field where the NFC code should be typed in, kinda like how barcode readers work (keyboard emulation)

Is this possible with PWA today?

Mutant answered 6/4, 2019 at 3:59 Comment(0)
H
8

The Web NFC API has a draft status at W3C. However, it seems to be the case that Chrome for Android has support for NFC, but only in experimental modus.

This means that currently, if you would release your application today, NFC will not generally be supported. However, the fact that Google has it available in experimental modus, seems to indicate it will be more widely available soon.

You can check the status here

Hydrosol answered 8/4, 2019 at 10:6 Comment(0)
F
3

For in-house solutions (or solutions where you have full control over the device) you can do it without NFC api in browsers (at least until it is available).

You will need to install Tasker app (paid, about 3 USD), which can create NFC read trigger, which then can open url like yourapp.com/{nfc_uid}. If YourApp is installed as PWA, you can select to open the url in the app instead of browser. This way it will look like the PWA is reading the NFC tag.

To make it work: 1. Install Tasker 2. Add new -> Event -> Network -> NFC Tag. Leave field blank and confirm (or just press back button) 3. Add new Task to this trigger: System -> Send intent Action: android.intent.action.VIEW Data: http://yourapp.com/%nfc_id Extra: com.android.browser.application_id:yourapp Target: Activity 4. Save

The reason we are not doing it using Task "Open url" is because we do not want to open new tab each time it is triggered.

If you have everything right and you scan NFC tag, your app should load with the NFC UID in url.

Funest answered 23/9, 2019 at 9:44 Comment(0)
S
0

I think that you have any solution, if you don't have solution yet, so I recommender check this web site.

https://www.chromestatus.com/feature/6261030015467520# https://googlechrome.github.io/samples/web-nfc/

to enable NFC experimental on Chrome type chrome://flags on G Chrome Android explorer

Selfimprovement answered 24/2, 2020 at 11:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.