An error occurred while connecting to camera 0: Status(-8, EX_SERVICE_SPECIFIC): '1: validateClientPermissionsLocked:1165: Caller ... (PID 10153, UID 6049) cannot open camera "0" without camera permission'
我正在尝试使用此代码让相机正常工作
代码语言:
javascript
复制
public static Camera getCameraInstance(){
Camera c = null;
try {
c = Camera.open();
} catch (Exception e) {
Log.e("getCameraInstance", "exception", e);
return c; // returns null if camera is unavailable
}
public static void checkCameraPermissions(Context context){
if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED)
// Permission is not granted