dm77 / barcodescanner

Barcode Scanner Libraries for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error while running app with basic implementation of Zxing

opened this issue · comments

W/CameraBase: An error occurred while connecting to camera: 0

You need to specify that you need camera access in your AndroidManifest.xml file and might also need to request camera permission in your activity class.

###AndroidManifest.xml

    <application>
        ...
        <uses-feature android:name="android.hardware.camera" />
        <uses-permission android:name="android.permission.CAMERA" />
    </applciation>

###MainActivity.java

    protected void onCreate(Bundle savedIntanceState) {
        ...
        ActivityCompat.requestPermissions(this, new String[]{CAMERA}, REQUEST_CAMERA);
    }    

See this guide for a full example.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.