title: Failed to open Camera
body: <p>I am developing an Android Application which currently looks fine in the emulator and on a Nexus 5 device.</p>
  
  <p>However, on a brand new Samsung J5 device, I do have an issue with the camera.
  Here is the output from the Logcat:</p>
  
  <pre><code>08-31 15:36:28.367    6551-6731/be.dsoft.debouwenconstructieapp E/CameraInstance﹕ Failed to open camera
  java.lang.RuntimeException: Fail to connect to camera service
          at android.hardware.Camera.&lt;init&gt;(Camera.java:550)
          at android.hardware.Camera.open(Camera.java:390)
          at com.google.zxing.client.android.camera.open.OpenCameraInterface.open(OpenCameraInterface.java:83)
          at com.journeyapps.barcodescanner.camera.CameraManager.open(CameraManager.java:121)
          at com.journeyapps.barcodescanner.camera.CameraInstance$3.run(CameraInstance.java:158)
          at android.os.Handler.handleCallback(Handler.java:739)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:135)
          at android.os.HandlerThread.run(HandlerThread.java:61)
  </code></pre>
  
  <p>Off course my permissions are set correctly because it's working on another device, but see below:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-feature android:name="android.hardware.camera" /&gt;
  &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
  </code></pre>
  
  <p>The following code gives me an issue:</p>
  
  <pre><code>  // Gets the view in the scanner will be showed.
     barcodeScannerView = (CompoundBarcodeView)findViewById(R.id.barcode_scanner_view);
     // Start capturing a set a callback to catch the results.
     capture = new CaptureManager(this, barcodeScannerView);
     capture.initializeFromIntent(getIntent(), savedInstanceState);
     barcodeScannerView.decodeSingle(callback);
  </code></pre>
  
  <p><strong>Note:</strong> On my Nexus 5 device, I'm running an Android 6 built, and there I had the same problem.
  After hours of searching, I finally found out that since Android 6, you can control permissions per app (and there, the camera was disabled). After enabling this, it was working fine on my device.</p>
  
  <p>Now, the Samsung device runs an Android 5 built where the app permissions cannot be changed, however, I do see the error mentioned above.</p>
  
  <p>Anoyone knows what's wrong?</p>
  
  <p>Kind regards</p>