public static boolean isPermissionGranted ( @ NonNull final Context context , @ NonNull final String permission ) { Condition . INSTANCE . ensureNotNull ( context , "The context may not be null" ) ; Condition . INSTANCE . ensureNotNull ( permission , "The permission may not be null" ) ; Condition . INSTANCE . ensureNotEmpty ( permission , "The permission may not be empty" ) ; return Build . VERSION . SDK_INT < Build . VERSION_CODES . M || ContextCompat . checkSelfPermission ( context , permission ) == PackageManager . PERMISSION_GRANTED ; }
Returns whether a specific permission is granted or not .