-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
🐛 Android: NFC not working after Camera is unmounted #516
Comments
well that's a weird one for sure. Thank you for the detailed report and reproduceable sample! I'll try to take a look at this soon, but last time I checked, the Camera component unmounts and cleans up correctly. 🤔 |
i had a same problem, try this. it works! |
I have just meet the same problem with an old samsung modele . But when i using a Redmi that works well . So i guess some model is incompatible to use nfc and camera in same time . |
Had the same problem on Samsung M33. I was using RNVC with frame processor to scan QR, and after to trigger NFC technology. For me it worked to set isActive as false on
|
I've the same problem on Android 13 devices (A12 is not affected). Devices tested: Samsung E22, Samsung Flip 3 (A13), SamsungA13 5G.... Settings isActive to false works only when screen with camera is shown at the time when prop is set. If isActive is to false in screen's blur event, NFC is still blocked (probably because Camera behave differently when it is in view/out of view). |
I confirm, on Samsung s20 ultra. |
Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3. I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here? Here's an instruction on how you can test that: #1674 (comment) If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉 Thank you! |
I've tested this issue with V3 + codescanner & simple frameprocessor (instead of previous vision-camera-code-scanner frameprocessor) and NFC works normally without any workarounds/hacks. It looks fixed, good job! |
I still experience this problem with V3. Few useful info:
|
Are you sure? The original poster said this problem happens on 2.9.x. I believe this is just a Camera2 problem? |
Hey! I just found out that I really forgot to close and dispose the locked Camera resources, so I just fixed that in this PR: #2174 There is still a small issue that causes once Camera component to turn into a blackscreen when navigating back and forth between two Camera components, that's a pretty rare edge case but I will still try to fix that soon when I have some free time. If you appreciate my time, expertise and dedication to this project, pleas 💖 consider sponsoring me on GitHub 💖 to support the development of this project. |
What were you trying to do?
A couple of our Android test handsets are unable to simultaneously receive data from the camera and NFC reader.
This is not that unusual. In some cases it's done to limit interference caused by the NFC chip when capturing images. In other cases, it's a limitation of the underlying hardware (number of pathways, SPI channels, etc).
https://stackoverflow.com/questions/34607168/nfc-unavailable-when-camera-is-open
https://stackoverflow.com/questions/68636728/usage-of-camera-blocks-nfc-reading-writing
For the affected handsets, when using RNVC, we noticed NFC remains permanently blocked after the Camera component is unmounted.
NFC starts working again after:
ACTIVITY_NEW_TASK
andFLAG_ACTIVITY_CLEAR_TASK
.I think it's related to RNVC because we have tested a different camera component which does not exhibit this issue.
My hunch is maybe the Camera is not being fully released after the component is unmounted?
App here for testing simultaneous NFC + Camera access: https://github.com/ldstein/MeshCameraTest/tree/nfc-test
Reproduceable Code
What happened instead?
No crashes, no errors. Just no response from NFC reader.
Relevant log output
No response
Device
Huawei VOC-L29 P30 Pro (Android 10), Xiaomi Redmi Note 9 Pro (Android 10 M2007JI7C)
VisionCamera Version
2.9.1
Additional information
The text was updated successfully, but these errors were encountered: