Alert when disconnecting NFC card
Greetings. I need to show one alert when an NFC card is connected and another when it is disconnected. I can't achieve the disconnection, I tried with setEventListener with the sessionClosed event, but it never shows the disconnection. Does anyone know how to obtain the event?
Example
useEffect(() => { NfcManager.setEventListener(NfcEvents.DiscoverTag, tag => { alert("NFC Tag found"); }); NfcManager.setEventListener(NfcEvents.SessionClosed, () => { alert("Session closed"); }); return () => { NfcManager.setEventListener(NfcEvents.DiscoverTag, null); NfcManager.setEventListener(NfcEvents.SessionClosed, null); }; }, [])
Hey, man Could you find the solution?
I'm still looking for a solution. Do you have any idea? Or do you know if the technology supports it?
No, unfortunately. I'm still looking for some solution as well. In case I resolve it, I post it here.
Hey, maybe I finded the solution. NfcManager.setEventListener(NfcEvents.StateChanged, data => this.CallbackDisconect(data)); So, the NfcEvents.StateChanged will fire when you turn on or turn of the NFC. So, maybe you can work with it.
The responses are: 'on' | 'turning_on' | 'off' | 'turning_off'
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.
This issue was closed because it has been stalled for 5 days with no activity.