CameraX Codelab故障

时间:2019-06-06 12:03:56

标签: android kotlin android-camera

CameraX入门

我目前正在使用新的CameraX API进行教程,但是失败

科特林

/** * Check if all permission specified in the manifest have been granted
     */
    private fun allPermissionsGranted() = `**PERMISSIONS_REQUIRED**`.all {
        ContextCompat.checkSelfPermission(
                requireContext(), it) == PackageManager.PERMISSION_GRANTED
    }

但是变量的名称改为private val REQUIRED_PERMISSIONS = arrayOf(Manifest.permission.CAMERA)

因此应该是

private fun allPermissionsGranted() = `**REQUIRED_PERMISSIONS**`.all {
        ContextCompat.checkSelfPermission(
                this, it) == PackageManager.PERMISSION_GRANTED
    }

0 个答案:

没有答案