Closed shashi-kiwi closed 2 years ago
Thanks for reporting the problem.
Could I ask You to provide more information about the mobile device You are using? I would like to reproduce this bug and analyse.
Note: Currently I am working on the next, major release of this library. The entire logic of permanent storage will be refactored, hoping it will solve e.g. Your problem.
Hello, first of all, thanks for sharing this library! I know this is an old report, but as I see It is still open and I am experiencing the same issue I will post here.
I am experiencing exactly the same problem as shashi-kiwi. Having my app open in foreground when I call the function:
let simulation;
const emulateTag = async () => {
const tag = new NFCTagType4(NFCContentType.Text, "TEST");
simulation = await (new HCESession(tag)).start();
}
I tap the reader and nothing seems to happen. However if I minimize the app (send it to the background) and tap then, the reader immediately detects the HCE.
Some additional information about hardware and software:
The device used to emit HCE signal:
Android - Samsung Galaxy S9+. Android version 10
React env:
react: 17.0.2 react-native: 0.67.2 react-native-hce: ^0.1.2
Thanks a lot again, I will update this post If I find a solution on my own!
Hi guys, recently I had the same problem on one of my devices. After lot of debugging and experimenting with "requireDeviceUnlock" property of aid_list.xml, I finally found the root cause. Possible steps to get rid out of the problem:
Please, let me know if it helped. If not, probably there is some other / internal limitation that comes from the device/system.
Hi! Thank you very much for the support!
I've tested your suggestions, unfortunately, it seems my system was not failing due to this.
However, I am getting closer to identifying the issue. There are two potential reasons.
First of all, I've just installed your example app from:
https://github.com/appidea/react-native-hce/tree/master/example
It seems to work perfectly from there, the reading of the data is consistent, and also it works with the application open / in the foreground.
So I was inspecting any differences with my app, and I noticed that my installed version of react-native-hce was lacking HCESessionProvider
Not sure if it was a cache issue or something but the yarn/npm version is not bringing the last version from GitHub.
So I installed the library directly from GitHub. And also I change the way of using it to be more like how it is done on the example app.
This gave me more consistent results, at least, 100% of the time reading the card has the correct data.
However, the original issue persists (The hce only works if the app is on background/minimized).
I'm suspecting that the issue might be because my app already had another nfc library used for tag reading, and now the two libs are coexisting on the same app.
https://github.com/revtel/react-native-nfc-manager
I believe that there must be a conflict between the two libraries and probably react-native-nfc-manager is overlapping react-native-hce feature while the app is open.
My next step will be to install a fresh app with the same configuration (react/native version etc) excluding react-native-nfc-manager to see if it works, this might lead to a starting point to identify the exact issue.
Hi, just wanted to share that I already solved this, just in case it might be useful for someone else.
The problem was, that we already had a library installed that uses NFC, the library is from a private repository from a customer, however, the issue was that the library was creating a listener at some point that was using the android NFC service all the time, and with this, it was preventing react-native-hce from working properly (That's why it worked when the app was in the background because the private NFC library had a listener to turn off the service when the app goes to background).
They made some changes to the library exposing a method that allows to stop the listener and now it works perfectly!
Hi, I integrate this lib in my current project but the issue is when i start simulation with text, if app is in forground the other device don't scan text. But If i put app in background then Other device recieve data . Please help in doing this in foreground as well. Thanks in Advance.Please answer asap. Shashi.