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

Can't retrieve tag information with background tag on IOS #715

Open
ImperialCrowns opened this issue Apr 18, 2024 · 3 comments
Open

Can't retrieve tag information with background tag on IOS #715

ImperialCrowns opened this issue Apr 18, 2024 · 3 comments

Comments

@ImperialCrowns
Copy link

Hey !

I wrote the following code :

const initNFC = () => {
  const onBackgroundTag = async (tag: TagEvent | null) => {
    console.log('onBackgroundTag', tag);
  };

  const initalizeBackgroundTag = async () => {
    // changed
    await NfcManager.start();

    const bgTag = await NfcManager.getBackgroundTag();
    onBackgroundTag(bgTag);

    // listen to other background tags after the app launched
    NfcManager.setEventListener(NfcEvents.DiscoverBackgroundTag, onBackgroundTag);
  };
  initalizeBackgroundTag();
};

function App() {
  initNFC();
  return (
    <View>
      <Text>Hello World</Text>
    </View>
  );
}

export default App;

I'm trying to retrieve tag informations when reading tag in background but the return value of NfcManager.getBackgroundTag is always null.
What am I doing wrong ? Is there something I miss ? Is it possible to do it ?

Environment:

  • Device: Iphone 14 Pro Max
  • iOS: 17.4.1
  • react-native-nfc-manager@3.14.14
  • Universal Links implemented and fully working

I've already tried many solutions proposed in previous issues, and it don't work.

@BhavyaCodeAlchemy
Copy link

It's Working fine in android ?

@ImperialCrowns
Copy link
Author

Yes, on Android it works perfectly.

@gigeos
Copy link

gigeos commented Apr 23, 2024

Same for me

I can't retrieve the tagId when the application is launched in background on iOS thanks to the little NFC notification that appears when a tag is touched.

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

3 participants