-
public final class ContextKt
-
-
Method Summary
Modifier and Type Method Description final static BooleanhasPermission(Context $self, String permission)Convenient way to get if a permission is granted from a Context. final static <ERROR CLASS>hasAllPermissions(Context $self, String permissions)Convenient way to get if a set of permissions are granted from a Context. final static <ERROR CLASS>hasAnyPermissions(Context $self, String permissions)Convenient way to get if a set of permissions are granted from a Context. -
-
Method Detail
-
hasPermission
final static Boolean hasPermission(Context $self, String permission)
Convenient way to get if a permission is granted from a Context. You may specified maxSdkVersion for this permission, for example : <code>Manifest.Permission.WRITE_EXTERNAL_STORAGE maxSdkVersion Build.VERSION_CODES.P</code> In this case users running P or later will be considered as PackageManager.PERMISSION_GRANTED and result will be true. If you omit maxSdkVersion and have specified maxSdkVersion from your manifest then Android will consider this as PackageManager.PERMISSION_DENIED and result will be false.
-
hasAllPermissions
final static <ERROR CLASS> hasAllPermissions(Context $self, String permissions)
Convenient way to get if a set of permissions are granted from a Context. All permissions need to be granted to get this returns true. You may specified maxSdkVersion for these permissions, for example : <code>Manifest.Permission.WRITE_EXTERNAL_STORAGE maxSdkVersion Build.VERSION_CODES.P</code> In this case users running P or later will be considered as PackageManager.PERMISSION_GRANTED and result will be true. If you omit maxSdkVersion and have specified maxSdkVersion from your manifest then Android will consider this as PackageManager.PERMISSION_DENIED and result will be false.
-
hasAnyPermissions
final static <ERROR CLASS> hasAnyPermissions(Context $self, String permissions)
Convenient way to get if a set of permissions are granted from a Context. At least one of permissions need to be granted to get this returns true. You may specified maxSdkVersion for these permissions, for example : <code>Manifest.Permission.WRITE_EXTERNAL_STORAGE maxSdkVersion Build.VERSION_CODES.P</code> In this case users running P or later will be considered as PackageManager.PERMISSION_GRANTED and result will be true. If you omit maxSdkVersion and have specified maxSdkVersion from your manifest then Android will consider this as PackageManager.PERMISSION_DENIED and result may be false.
-
-
-
-