Comments (10)
You should request camera permission on API >= 23
https://github.com/yuriy-budiyev/lib-demo-app/blob/master/app/src/main/java/com/budiyev/android/libdemoapp/codescanner/CodeScannerActivity.java
from code-scanner.
ask for runtime camera permission and you are good to go.
from code-scanner.
Facing the same issue on some devices.
Android manifest has permission for Camera and there is run-time permission modal implemented in the Activity as well. Library works flawlessly in devices API >23.
Still found the same error.
Fatal Exception: java.lang.RuntimeException: Fail to connect to camera service at android.hardware.Camera.(Camera.java:653) at android.hardware.Camera.open(Camera.java:494) at com.budiyev.android.codescanner.CodeScanner$InitializationThread.initialize(CodeScanner.java) at com.budiyev.android.codescanner.CodeScanner$InitializationThread.run(CodeScanner.java)
Device info:
Device
Brand: OPPO
Model: X9009
Orientation: Portrait
RAM free: 1.73 GB
Disk free: 29.26 GB
Operating System
Version: 5.1
Orientation: Portrait
Rooted: No
from code-scanner.
Have you added camera permission to manifest?
from code-scanner.
@yuriy-budiyev yes. Permission is added in manifest as well as runtime permission is also asked. Therefor Library is working in majority of devices in the developed App. I have found some devices mentioned earlier which don't support this library (Original Comment).
I would recommend implementation of Camera2 API compatibility. My project is set to minSdkVersion = 19.
Although CameraX is introduced in Android Jetpack, it requires minSdkVersion = 23, which will not benefit to this library.
from code-scanner.
I will update to Camera2 API when devices lower than 21 SDK become irrelevant
from code-scanner.
It is showing the issues with the camera permission
from code-scanner.
facing this issue. is there any update?
below Is the stack trace
Fatal Exception: java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.(Camera.java:633)
at android.hardware.Camera.open(Camera.java:431)
at com.budiyev.android.codescanner.CodeScanner$InitializationThread.initialize(CodeScanner.java:835)
at com.budiyev.android.codescanner.CodeScanner$InitializationThread.run(CodeScanner.java:812)
from code-scanner.
Check camera permissions and update to 2.1.2 for better error handling.
from code-scanner.
E/AndroidRuntime: FATAL EXCEPTION: cs-init
Process: com.lightlogistics.vaast, PID: 5369
java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.(Camera.java:637)
at android.hardware.Camera.open(Camera.java:458)
at com.budiyev.android.codescanner.CodeScanner$InitializationThread.initialize(CodeScanner.java:835)
at com.budiyev.android.codescanner.CodeScanner$InitializationThread.run(CodeScanner.java:812)
E/CustomActivityOnCrash: App has crashed, executing CustomActivityOnCrash's UncaughtExceptionHandler
java.lang.RuntimeException: Fail to connect to camera service
at android.hardware.Camera.(Camera.java:637)
at android.hardware.Camera.open(Camera.java:458)
at com.budiyev.android.codescanner.CodeScanner$InitializationThread.initialize(CodeScanner.java:835)
at com.budiyev.android.codescanner.CodeScanner$InitializationThread.run(CodeScanner.java:812)
i have asked permission and it works but some times app crashes
i am using 'com.budiyev.android:code-scanner:2.1.0' version
from code-scanner.
Related Issues (20)
- Scanner stucks on Xiaomi Redmi Note 10 Pro HOT 3
- Camera too dark when embed CodeScannerView to Jetpack Compose
- Black camera screen on startPreview() until the screen is touched
- There is a way to give a feedback to user on continuous scan?
- qr code not popping up after scan the qr
- Black screen on onePlus nord CE HOT 3
- Does the codescanner have a function to take in uri?
- Orientation change issue
- Crash on google play pre-launch & also on production on clients devices
- How to enable and disable flash light with flash icon? HOT 7
- Android 33 Library does not work
- Library is not working HOT 2
- Flash blink while set ScanMode.SINGLE
- Is there any way to speed up?
- How can we add text below frame ? HOT 1
- NFC Functionality Stops Working When QR Code Scanning Preview is Started on Android 13 HOT 1
- Blank screen on xiaomi redmi A2 HOT 5
- Flash not working in Android 11 HOT 3
- QR scan starts lagging HOT 1
- Scan returns wrong data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-scanner.