我目前正在使用新的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
}