Skip to content

PermissionHandler

PermissionHandler #

Bases: Service

Manages permissions for the application.

This control is non-visual and should be added to Page.services list.

Note

Currently only supported on Android, iOS, Windows, and Web platforms.

Raises: FletUnsupportedPlatformException: If the platform is not supported.

get_status_async(permission: Permission, timeout: int = 10) -> PermissionStatus | None #

Gets the current status of the given permission.

PARAMETER DESCRIPTION
permission

The Permission to check the status for.

TYPE: Permission

timeout

The maximum amount of time (in seconds) to wait for a response.

TYPE: int DEFAULT: 10

Returns: A PermissionStatus if the status is known, otherwise None. Raises: TimeoutError: If the request times out.

open_app_settings_async(timeout: int = 10) -> bool #

Opens the app settings page.

PARAMETER DESCRIPTION
timeout

The maximum amount of time (in seconds) to wait for a response.

TYPE: int DEFAULT: 10

Returns: True if the app settings page could be opened, otherwise False. Raises: TimeoutError: If the request times out.

request_async(permission: Permission, timeout: int = 60) -> PermissionStatus | None #

Request the user for access to the permission if access hasn't already been granted access before.

PARAMETER DESCRIPTION
permission

The Permission to request.

TYPE: Permission

timeout

The maximum amount of time (in seconds) to wait for a response.

TYPE: int DEFAULT: 60

Returns: The new PermissionStatus after the request, or None if the request was not successful. Raises: TimeoutError: If the request times out.