react-native-nfc-manager icon indicating copy to clipboard operation
react-native-nfc-manager copied to clipboard

Can't retrieve tag information with background tag on IOS

Open ImperialCrowns opened this issue 1 year ago • 3 comments

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
  • [email protected]
  • Universal Links implemented and fully working

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

ImperialCrowns avatar Apr 18 '24 14:04 ImperialCrowns

It's Working fine in android ?

BhavyaCodeAlchemy avatar Apr 19 '24 12:04 BhavyaCodeAlchemy

Yes, on Android it works perfectly.

ImperialCrowns avatar Apr 23 '24 07:04 ImperialCrowns

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.

gigeos avatar Apr 23 '24 21:04 gigeos

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jul 23 '24 01:07 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Aug 07 '24 01:08 github-actions[bot]

I'm also having this issue, I can't get any scan information.

Also, if the issue is tagged for iOS, saying that it works perfectly on Android is probably not going to be relevant information.

wuguishifu avatar Oct 09 '24 18:10 wuguishifu

Same!!!

ChronoByteCosmonaut avatar Nov 21 '24 15:11 ChronoByteCosmonaut