chandra sekaran
chandra sekaran

Reputation: 51

Zxing barcode camera options

I want to integrate the zing barcode scanner to my android application. so i used zing integrator as follows

public Button.OnClickListener mScan = new Button.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
        intent.setPackage("com.google.zxing.client.android");
        intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
        startActivityForResult(intent, 0);
    }};public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
            String contents = intent.getStringExtra("SCAN_RESULT");
            String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
            // Handle successful scan
        } else if (resultCode == RESULT_CANCELED) {
            // Handle cancel
        }
    }
}

i would like to implement this application in android tablet (2.2 version) which contains two cameras. when i start this function, this automatically starts performing scan with back camera(Main), but according to my application needs, i need to perform the barcode scanning using only front camera. is there option something like

intent.putExtra("SCAN_MODE", "QR_CODE_MODE","FRONT_CAMERA"); 
  1. is this possible to enable front camera with help of this zingintegrator function? if not, do i need to implement the whole zing open source code, so will it be possible to perform the scanning with only front camera. Thank you.

Upvotes: 5

Views: 5009

Answers (1)

Sean Owen
Sean Owen

Reputation: 66886

No, there's no support for this, really. The APIs for requesting the front camera did not appear until Android 2.3 (I think?) and Barcode Scanner is on 1.5 right now, moving to 2.1 soon. Camera.open() opens the rear camera by default and will not select the front camera.

Barcode Scanner does have an option to reverse the camera image, since we're told that at least one tablet only has a front camera, and for anything to work you need to reverse the image.

I can tell you that the front camera on devices is much worse than the rear camera in general. its resolution and CCD responsiveness make it hard to scan this way.

Upvotes: 2

Related Questions