Zxing barcode camera options

99封情书 提交于 2019-12-22 08:32:24

问题


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.

回答1:


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.



来源:https://stackoverflow.com/questions/7901299/zxing-barcode-camera-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!