-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Android: camera not opening #861
Comments
Having the same problem here. Found some threads all over github about how the solution is to make all the application transparent so you can see the camera, but that doesn't work for me. |
Well, hopefully someone can give us a hint @josemariagarcia95 :) |
Okey, I've just tried to run an example I found about this plugin in a blank ionic project (blank template), and it opens correctly and all the scan options seem to work, so maybe it's about to dig up in the "hiding the rest of the interface" idea @codafish-gmbh. I'll try other things later. |
same issue here |
@josemariagarcia95 could you share your solution if you find one? I'm also stuck on this one for a few days now. As suggested on ionic forums it indeed has something to do with hiding the interface - which i tried with no luck. EDIT: Did some digging. Stumbled upon a working solution here, without hiding anything: ionic-team/capacitor#1213 (comment) |
I haven't tried anything new in my project. |
Hi everyone, I've been doing some experiments and they've all failed, but I finally found a solution that didn't mean to create a new simple project. TL DR: Long explanation. ionic cordova plugin add phonegap-plugin-barcodescanner
npm install @ionic-native/barcode-scanner The Cordova plugin seems to work in some cases (in a project using the .has-camera {
--background: transparent none !important"
background: transparent none !important;
} And added it to several parts of the app when the scanned started. I tried several options of this (making the Finally, I noticed that I was using Cordova to access this plugin, and although it is still fully compatible (presumably) with Ionic, it is my understanding that Capacitor is the preferrable system to use, so I uninstalled the Cordova plugin ( npm install phonegap-plugin-barcodescanner
npm install @ionic-native/barcode-scanner
ionic cap sync The barcode scanner is now working in my application. Hope this can shed some light in anyone's way. If this doesn't work to you either, other ideas that I had was trying previous versions of this plugin, thing that has worked for others, so maybe it is another thing to try in the meanwhile. |
@josemariagarcia95: Thanks a lot for your input. I replaced Cordova by Capacitor and everything works like a charm!!! :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Expected Behaviour
Scan functionality works on iOS and Android.
Actual Behaviour
iOS: everything is working as expected.
Android: camera not opening
Reproduce Scenario (including but not limited to)
Trying to scan QR code. Works perfectly on iOS, on Android different versions doesn't open. Is there anything special to configure such as permissions?
Platform and Version (eg. Android 5.0 or iOS 9.2.1) / (Android) What device vendor (e.g. Samsung, HTC, Sony...)
Android Pixel 3 (Android 10)
Zebra TC25BJ (Android 7)
Cordova CLI version and cordova platform version
cordova --version
9.0.0 (cordova-lib@9.0.1)
cordova platforms
Installed platforms:
android 8.1.0
ios 5.1.1
Available platforms:
browser ^6.0.0
electron ^1.0.0
osx ^5.0.0
windows ^7.0.0
Plugin version
cordova plugin version | grep phonegap-plugin-barcodescanner
phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"
Sample Code that illustrates the problem
I'm also checking the permissions using (android-permissions) in app.component.ts:
AndroidManifest.xml:
I've tried everything but the camera scan mode will not appear on Android devices. Anyone an idea what could be the reason for that behavior?
The text was updated successfully, but these errors were encountered: