Class DynamicPermissionUtils

java.lang.Object
com.pranavpandey.android.dynamic.support.util.DynamicPermissionUtils

public class DynamicPermissionUtils extends Object
Helper class to work with permissions and DynamicPermission.
  • Constructor Details

    • DynamicPermissionUtils

      public DynamicPermissionUtils()
  • Method Details

    • getPermissionSettingsAction

      @NonNull public static String getPermissionSettingsAction(@NonNull String permission)
      Get permission settings action according to the permission name.
      Parameters:
      permission - The permission name.
      Returns:
      The permission settings action.
    • openPermissionSettings

      public static boolean openPermissionSettings(@NonNull Context context, @NonNull String permission, @Nullable Class<?> clazz)
      Open the settings activity according to the permission name.
      Parameters:
      context - The context to start the activity.
      permission - The permission name.
      clazz - The optional class to be supplied as bundle.
      Returns:
      true if permissions settings activity can be opened successfully. Otherwise, false.
    • openPermissionSettings

      public static boolean openPermissionSettings(@NonNull Context context, @NonNull String permission)
      Open the settings activity according to the permission name.
      Parameters:
      context - The context to start the activity.
      permission - The permission name.
      Returns:
      true if permissions settings activity can be opened successfully. Otherwise, false.
      See Also:
    • launchAppInfo

      public static boolean launchAppInfo(@NonNull Context context)
      Launch app info by extracting the package name from the supplied context.
      Parameters:
      context - The context to start the activity.
      Returns:
      true if permissions settings activity can be opened successfully. Otherwise, false.
    • getPermissionIcon

      @DrawableRes public static int getPermissionIcon(@NonNull String permission)
      Get permission icon drawable resource according to the permission name.
      Parameters:
      permission - The permission name.
      Returns:
      The permission icon drawable resource.
    • getPermissionTitle

      @StringRes public static int getPermissionTitle(@NonNull String permission)
      Get permission title string resource according to the permission name.
      Parameters:
      permission - The permission name.
      Returns:
      The permission title string resource.
    • getPermissionSubtitle

      @StringRes public static int getPermissionSubtitle(@NonNull String permission)
      Get permission subtitle string resource according to the permission name.
      Parameters:
      permission - The permission name.
      Returns:
      The permission subtitle string resource.