eu-digital-green-certificates / dgca-verifier-app-android

Repository for the dgca verifier android app.
Apache License 2.0
102 stars 117 forks source link

Add Option to Switch Camera Used #95

Open psavva opened 3 years ago

psavva commented 3 years ago

Dear Team,

I would like to request a feature where the camera can be switched between via a button/menu on the Verifier.

Android Devices such as the Honeywell and Zebra support QR Code scanning via the Top facing camera, and would like to have the option to utilize the fast and highly reliable camera.

Please include an option to choose/switch which camera is used.

denzilferreira commented 3 years ago

I've implemented this on the Finnish Verifier app. I edited the layout fragment_code_reader.xml to add a button for toggling the camera (below as btnCameraToggle).

I added to the CodeReaderFragment, in the onViewCreated() method:

val camManager = requireActivity().getSystemService(Context.CAMERA_SERVICE) as CameraManager
        if(camManager.cameraIdList.size == 1) {
            binding.btnCameraToggle.visibility = View.GONE
        } else {
            binding.btnCameraToggle.setOnClickListener {
                val camSetup = binding.barcodeScanner.cameraSettings
                if(binding.barcodeScanner.isPreviewActive) binding.barcodeScanner.pause()
                val alternativeCam = camManager.cameraIdList.indices.filter { it != camSetup.requestedCameraId }
                camSetup.requestedCameraId = alternativeCam.first()
                binding.barcodeScanner.cameraSettings = camSetup
                binding.barcodeScanner.resume()
            }
        }

This hides the button for phones without two cameras and toggles between the two. QRCode reading works on front facing camera as expected.

daviddem1971 commented 3 years ago

Additionally it would be good to add an option to scan a QR code from the gallery, so that copies of certificates sent electronically can be authenticated on the same device they are received... Pretty much all QR code scanners feature this option...

psavva commented 3 years ago

Additionally it would be good to add an option to scan a QR code from the gallery, so that copies of certificates sent electronically can be authenticated on the same device they are received... Pretty much all QR code scanners feature this option...

This feature would really make more sense on the wallet app, I'm not so sure about the verifier, unless you have publicly accessible verifier apps which you want to verify your own QR code...

daviddem1971 commented 3 years ago

Additionally it would be good to add an option to scan a QR code from the gallery, so that copies of certificates sent electronically can be authenticated on the same device they are received... Pretty much all QR code scanners feature this option...

This feature would really make more sense on the wallet app, I'm not so sure about the verifier, unless you have publicly accessible verifier apps which you want to verify your own QR code...

Well I do have the publicly available verifier app from Luxembourg covidcheck.lu, and it unfortunately doesn't have that feature. As a certificate holder, I am however grateful and relieved that at least one country had the foresight to release a publicly accessible verifier app. And I do not understand why verifier apps should not be publicly accessible worldwide... what are my vaccination certificates good for if not everyone can easily verify their authenticity???

psavva commented 3 years ago

Additionally it would be good to add an option to scan a QR code from the gallery, so that copies of certificates sent electronically can be authenticated on the same device they are received... Pretty much all QR code scanners feature this option...

This feature would really make more sense on the wallet app, I'm not so sure about the verifier, unless you have publicly accessible verifier apps which you want to verify your own QR code...

Well I do have the publicly available verifier app from Luxembourg covidcheck.lu, and it unfortunately doesn't have that feature. As a certificate holder, I am however grateful and relieved that at least one country had the foresight to release a publicly accessible verifier app. And I do not understand why verifier apps should not be publicly accessible worldwide... what are my vaccination certificates good for if not everyone can easily verify their authenticity???

I suggest you look here: https://github.com/eu-digital-green-certificates/dgc-participating-countries/issues/10

superasty commented 3 years ago

Is it possible to use the default camera front?