If you are running an Android app on a device and the camera screen is black or it fails with the message "The device failed to give access to the camera":
- Check that the startScanning() function is called.
- Check that your app has permission to use the camera. For this go to your project settings under "Android Application" and look through the "Required permissions", make sure that the Camera has a checkmark. Additionally, check the value for "Target Android version". If the target version is below Android 6.0/ (API level 23) there are no additional changes needed. Otherwise, you will have to make further adjustments as the Android permission system has changed with version 6.0:
-
- Check that you are asking for specific permissions during runtime (simply listing them in the manifest does not guarantee permissions anymore).
- Reference the CameraPermissionActivity.java file, found in our public GitHub samples repo. We make use of the
requestPermissions()
method, defined inActivityCompat
(see Android docs here). - Extend CameraPermissionActivity.java, and ensure you have permissions before starting the camera, please reference BarcodeCaptureSimpleSample for more details regarding the implementation.
- Check your app's permissions in the app manager of your Android device. It is possible that for some reason you declined to give it camera permission at an earlier point in time.
- Check that hardware acceleration is set to ON (if Android API level < 14)
If you're experiencing a black screen issue on Android while using our WebSDK, please go here instead: https://support.scandit.com/hc/en-us/articles/360002624311-Why-can-t-I-access-the-camera-in-the-Web-SDK-why-do-I-get-a-black-camera-screen-.