Problems reading NFC Card

Hello, good afternoon.

To better control the way our users access the internet, we developed an App that uses the WebViewer component to create a "mini-browser" that can only access a list of sites we allow.

Now, we developed a website that uses Web NFC to read NFC Tags. The site works perfectly in Chrome (it shows a popup asking for NFC permissions), but when open it in the WebViewer, it displays a "NO NCF Permissions" error, an no popup message appears.

Can anyone help me?

Best Regards,
Rui

Perhaps dragging in the NFC component from the Palette will provide the permission ?

That was my first idea, but it didn't work.

I even called the Ask for Permission function, but it was automatically granted.

image

It goes automatically to the permission granted Event.

image

Without any user input.

You will need a webviewer which is able to ask for that permission... did you try the custom webviewer extension @vknow360 ?

However I'm not sure, if this permission is available there

Taifun

Hello Taifun.

Just tested the custom webviewer extension but it also doesn't ask for the permission.

The full error message is "Error: NotAllowedError: NFC permission request denied."

Rui

Please show the relevant blocks.

Hello @vknow360.

In terms of code blocks is very simple:

image

All the code to read the NFC Tag is in the webpage.

Basically it's the scan example you can find here:

In Chrome it shows something similar to this:

image

Rui

CustomWebView doesn't handle everything itself, unfortunately.
You will have to configure OnPermissionRequest event and GrantPermission method accordingly.

Here is an example

Taifun

Thank you very much @vknow360 and @Taifun.

I will test it and let you know!

Hello @vknow360 & @Taifun.

I've tested OnPermissionRequest and GrantPermission but it dind't work.

The 'OnPermissionRequest' event is not even called.

I've tried to grant permissions using this:

image

Can it be that CustomWebView doesn't support Web NFC?

Best Regards,
Rui

Hello @vknow360 & @Taifun.

Did you have a chance to take a look at this?

There is lack of information for this feature.

in this answer javascript - How do you obtain permissions from web-nfc API? - Stack Overflow there is a link to a sample page Web NFC Sample which might help?

Taifun

We based our website that reads NFC tags on the examples you mentioned @Taifun.

It works fine on Chrome, but when we use WebViewer or CustomWebView it doesn't work.

Rui

Hello @Taifun & @vknow360.

Apparently the error message ""NotAllowedError: NFC permission request denied." is not due to lack of permissions, but because WebViewer and CustomWebView don't support WebNFC.

Best Regards,
Rui

Yes, they don't support WebNFC.

Hi @vknow360, good evening.

I'm using the latest version of CustomWebView (12.0beta). Do you know if WebNFC is now supported?

Best Regards,
Rui

According to MDN documentation, WebView for Android is supported.

There is enough information here to answer your question.