Android Question How to use front facing camera for barcode scanning

DavidTheGeek

Member
Licensed User
Longtime User
This application provides details of product when they hold a barcode up to an Android device mounted on a wall.

I use Erels excellent example (as updated for B4A v13) which works well with the rear camera, but how do I set the options such that the front camera is used?
 

teddybear

Well-Known Member
Licensed User
Which example, if it is using CameraExClass, you can do Initialize FrontCamera as True
B4X:
camEx.Initialize(pnlPreview, True, Me, "Camera1")
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
in the not too distant future, we'll all be required to wear a qr code
tatooed on our foreheads for identification in front of the telescreen
in our homes. by that time, the authorities will have solved the
problem of a wall-mounted front-facing camera. in my country, we
already enjoy this security feature.

until then, i'm afraid you might have to resort to using a different
application; the api (such as it is) for google code scanner doesn't
expose camera settings. the whole idea behind it is that it allows
you to use a camera for simple scanning without needing the camera
permission or writing a camera app.
 

Attachments

  • citizen_drgottjr.jpg
    170.1 KB · Views: 33
Upvote 0

teddybear

Well-Known Member
Licensed User
This example:

https://www.b4x.com/android/forum/t...imple-to-use-barcode-scanning.160725/#content

Which as far as I can see, doesn't use the camera class.
The example is using GmsBarcodeScannerOptions.Builder,there is no method for selecting a camera.
see this doc

Public Methods​

public GmsBarcodeScannerOptions.Builder allowManualInput ()​


Allows users to input barcode manually. Disallowed by default.

public GmsBarcodeScannerOptions build ()​


Builds a GmsBarcodeScannerOptions instance.

public GmsBarcodeScannerOptions.Builder enableAutoZoom ()​


Allows auto-zoom feature, disabled by default.

public GmsBarcodeScannerOptions.Builder setBarcodeFormats (int format, int...moreFormats)​


Sets the interested barcode formats defined in Barcode.BarcodeFormat.
 
Upvote 0

DavidTheGeek

Member
Licensed User
Longtime User
Ah. I see.

I thought I had missed something obvious but it seems not this time.

Thanks for responding. I think that before we end up with the tattoos which drgottjr refers to, we'll have chip implants at birth, like cats and dogs. Needs no camera....
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…