ministero-salute / it-dgc-verificaC19-android

VerificaC19 is the official Italian customization of the EU Digital COVID Certificate Verifier App for the Android Operating System
https://www.dgc.gov.it
Apache License 2.0
101 stars 54 forks source link

Front camera? #96

Closed HackeCode closed 3 years ago

HackeCode commented 3 years ago

Hi, how ca we use front camera? there is a way?

EdossProject commented 3 years ago

It also interests me

zubeer95 commented 3 years ago

The camera is selected in CodeReaderFragment.kt:95 when calling: binding.barcodeScanner.initializeFromIntent(requireActivity().intent)

A quick and dirty solution is to write in Firstactivity.tk:164: intent.putExtra(Intents.Scan.CAMERA_ID,1);

Instead of 1 you have to get the camera id of your front camera, there are several ways to do that: for instance you can use a button to toggle between a list of available ids.

EdossProject commented 3 years ago

I use this code:

private fun openQrCodeReader() { val intent = Intent(this, MainActivity::class.java) intent.putExtra(Intents.Scan.CAMERA_ID,1); startActivity(intent) }

But not work Frontal Camera

astagi commented 3 years ago

@EdossProject try the code provided by @zubeer95.

I'll close this issue cause it's not strictly related to the final app, it will be forced to use back camera for certificates scanning.