QRCodeReaderView
QRCodeReaderView copied to clipboard
Frames are not processed after lock/unlock of the device
The problem can be reproduced with the following steps,
- Start the application and let the camera preview to appear.
- Press the power button of the tablet to lock the device
- Press the power button of the tablet to unlock the device
- Target a QR code The logs doesn't show any change on SurfaceView
The QR is not recognized
- Send the application on the background pressing the home button
- Open the application again The logs show $ surfaceDestroyed $ surfaceChanged
The QR is now recognized.
I found a workaround which fixes this when i change the SurfaceView visibility in onPause/onResume.
I am not sure about visibility approach as it probably remains camera active. I have investigated slightly and come to conclusion that SurfaceView lifecycle is not currently handled properly in lib, looks as a bug. What I have done to fix the problem is added in order to re-initialize SurfaceView
private QRCodeReaderView camera; ...
@Override protected void onResume() { super.onResume(); camera.surfaceCreated(camera.getHolder()); camera.startCamera(); }
Hope it helps.
thanks, you saved my time!