Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal example provided in documentation works on IOS but does not detect tag on Android #747

Open
kitkline opened this issue Sep 19, 2024 · 2 comments

Comments

@kitkline
Copy link

kitkline commented Sep 19, 2024

Hi all, advice or help appreciated (ps - awesome tool!)

Following the documentation we have built NFC tag scanning into our app and works perfectly on IOS but on Android the tag is not read (to tag is ever returned from await NfcManager.getTag()

Checked - the phone is NFC capable and the app NFC tools on the phone can read the tag (i.e issue is in our code - not in the phone).

Checked - AndroidManifest.xml contains:

After the tech is launched by the user tapping the 'scan' button there is no error but scanning the tag does nothing. Pairing the phone with Android studio we see the following in logcat:

2024-09-19 23:05:01.901 14222-14419 ReactNativeNfcManager org.gearlog.app D isSessionAvailable: false
2024-09-19 23:05:01.905 14222-14419 ReactNativeNfcManager org.gearlog.app D registerTagEvent
2024-09-19 23:05:01.908 14222-14419 ReactNativeNfcManager org.gearlog.app I enableForegroundDispatch, enable = true

And then nothing else

Phone is Samsung A10 running Android 11 (it's a cheap old phone we used for physical testing - but should work given that NFC tools works?)

How can we generate more debug or logging to help resolve?

Code follows...


  async scanNFC() {
    try {
      alert('We see this message');
      await NfcManager.requestTechnology(NfcTech.Ndef);
  
      const tag = await NfcManager.getTag();
    alert('We never see this message');
       -> our tag parsing code follows but we never get to that as never get a tag

     
    } catch (ex) {
     	-> our error alerting
     	
      );
    } finally {
        NfcManager.cancelTechnologyRequest();
    }
  }

@kitkline
Copy link
Author

To add further to this we have boiled the code down to the absolute minimum and the basic issue (Android) only is that 'await NfcManager.getTag()' simply never resolves. The NFCManager is running and once the app is on that screen the normal android phone default response to a nearby tag no longer occurs - so clearly the app has grabbed NFC as the manager starts - but when an tag is close NfcManager.getTag() does not resolve. Could this be something to do with how android sends the tag event on older phones (A10 running Android 11 which can run the app NFC tools just fine)

@kitkline
Copy link
Author

kitkline commented Sep 23, 2024

To add further to this we have also tried on a Google Pixel 5 running Android 14 and found the minimal example works. In summary an Android 11 device does not work and an Android 14 does. We would like to support older devices so if it is possible to get some advice that would me much appreciated...

Many thanks for such an awesome module!

Cheers
Kit

@kitkline kitkline changed the title NDEF scanner app works on IOS but not on Android Minimal example provided in documentation works on IOS but does not detect tag on Android Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant