6.0权限申请

    xiaoxiao2025-10-29  8

    try { cameraManager.openDriver(surfaceHolder); // Creating the handler starts the preview, which can also throw a // RuntimeException. if (handler == null) { handler = new CaptureActivityHandler(this, cameraManager, scanMode); Log.e("hongliang1", "handler new成功!:" + handler); } initCrop(); } catch (Exception ioe) { Log.e(TAG, "hongliang", ioe); //弹出提示,报错 ioe.printStackTrace(); listener.scanError(new Exception("相机打开出错,请允许该权限的获取!")); requestMultiplePermissions(); } @TargetApi(Build.VERSION_CODES.M) private void requestMultiplePermissions() { //此数组放权限列表,以摄像头权限为例 String[] permissions = {Manifest.permission.CAMERA}; activity.requestPermissions(permissions, REQUEST_CODE); }
    转载请注明原文地址: https://ju.6miu.com/read-1303643.html
    最新回复(0)