override fun onRequestPermissionsResult( requestCode: Int, permissions: Array<String?>, grantResults: IntArray ) { if (requestCode == ALLOW_PERMISSIONS && grantResults.size > 0) { val permissionsNotAllowed: MutableList<String?> = ArrayList() for (i in permissions.indices) { if (grantResults[i] == PackageManager.PERMISSION_DENIED) { permissionsNotAllowed.add(permissions[i]) } } if (permissionsNotAllowed.isEmpty()) { initEvent() } else { permissionNotEnabled() } } else { permissionNotEnabled() } }
This method is a callback . Check the user 's answer after requesting permission .