Interface PermissionsManager

Allows checking and requesting application permissions.

interface PermissionsManager {
    askForPermission(permission: string): Promise<boolean>;
    askForPermission(permissions: string[]): Promise<{
        [permission: string]: boolean;
    }>;
    isPermissionGranted(permission: string): boolean;
    isPermissionGranted(permissions: string[]): {
        [permission: string]: boolean;
    };
    shouldShowRequestPermissionRationale(permission: string): boolean;
    shouldShowRequestPermissionRationale(permissions: string[]): {
        [permission: string]: boolean;
    };
}

Methods

  • Requests a permission to be granted to this application. This permission must be requested in your manifest, and should not be granted to your app, and should have protection level dangerous, regardless whether it is declared by the platform or a third-party app.

    Note: This operation requires the user interaction, consider using ActivityManager.runUserInteraction to ensure that consequent UI-related operations are suspended until this one is completed.

    Parameters

    • permission: string

      The requested permission.

    Returns Promise<boolean>

  • Requests permissions to be granted to this application. These permissions must be requested in your manifest, they should not be granted to your app, and they should have protection level dangerous, regardless whether they are declared by the platform or a third-party app.

    Parameters

    • permissions: string[]

      The requested permission.

    Returns Promise<{
        [permission: string]: boolean;
    }>

  • Returns true if you have been granted a particular permission, or false otherwise.

    Parameters

    • permission: string

      The name of the permission being checked.

    Returns boolean

  • Returns a mapping from a permission name to a boolean indicating that you have been granted a particular permission.

    Parameters

    • permissions: string[]

      An array of permission your app wants to request.

    Returns {
        [permission: string]: boolean;
    }

    • [permission: string]: boolean
  • Gets whether you should show UI with rationale before requesting a permission.

    Parameters

    • permission: string

      A permission your app wants to request.

    Returns boolean

    Whether you should show permission rationale UI.

  • Gets whether you should show UI with rationale before requesting a permission.

    Parameters

    • permissions: string[]

      An array of permission your app wants to request.

    Returns {
        [permission: string]: boolean;
    }

    Mapping from permission name to a boolean indicating whether you should show permission rationale UI.

    • [permission: string]: boolean