AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas para móviles / Funciones de permisos
  • Overview
  • How permissions work
  • Install-time permissions
  • Runtime permissions
  • Special case: background location
  • Advanced permission management in WLanguage
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Overview
Android applications require permissions to offer certain features that may require access to sensitive data or sensitive device functions: taking a photo, getting the user's location, listing contacts, etc.
WINDEV Mobile automatically detects the necessary permissions according to the features used by the application (WLanguage functions, controls, etc.).
You can also add or remove them manually from the generation wizard. For runtime permissions, the Android framework automatically manages the user permission request when a relevant feature is used.
Everything is automatic.
However, in some situations, the developer needs to manage the application permissions more finely. A simple example: the developer needs to know whether a permission has already been granted, in order to display an explanatory window telling the user why he or she must accept a given permission in order to use an application feature.
WINDEV Mobile offers WLanguage functions and a variable type to manage permissions from the code.
How permissions work
All permissions required by an application must be declared in the application manifest. All these permissions can be viewed once the application has been installed on the device by going to the app info in the device settings.
A list of existing permissions is available at the following address: https://developer.android.com/reference/android/Manifest.permission.
There are different types of permission:
  • Install-time permissions.
  • Runtime permissions.

Install-time permissions

These permissions allow the application to access data or use features that minimally affect the system or other applications. When one of these permissions is declared in the application manifest, the system automatically grants the application this permission when the user installs the app, without any intervention.

Runtime permissions

Runtime permissions, also known as dangerous permissions, allow the application to access data or use sensitive functions: private user data, geolocation, microphone or camera activation, etc. Therefore, a user action is needed to grant the app this permission.
If the permission has not yet been granted, and the app tries to access certain functionalities or sensitive data, a prompt appears asking the user to grant permission to the application.
  • If the user grants this permission, the functionality or data becomes accessible and permission will no longer be requested unless the user revokes this permission in the application settings.
  • If the user denies this permission, the feature or data will not be accessible (usually this causes the corresponding WLanguage function to fail) and the permission will be requested again next time.
  • Starting with Android 11, the user can also grant a permission temporarily ("Only this time"). In this case, the permission is valid as long as the current window remains visible. If the application is sent to the background, the permission remains valid for a short period only.
    This type of permission is only available for location, camera and microphone permissions.

Special case: background location

To allow an application to access the location of the device in the background, you must do the following:
  1. Request the location permission (ACCESS_[FINE/COARSE]_LOCATION permission via PermissionRequest with the permLocation or permFineLocation constant).
  2. If the previous permission is granted, request background location access (ACCESS_BACKGROUND_LOCATION permission via PermissionRequest with the permBackgroundLocation constant).
In this case, a special permission request window is displayed. This window includes options to allow access to the position of the device:
  • While using the app,
  • Only this time,
  • Deny,
  • Change the application settings.
The user can allow the application to access location when it is active ("While using the app"), temporarily, deny access, or go to the application settings to allow location access in the background.
Advanced permission management in WLanguage
To finely manage permissions, WLanguage includes:
  • Several functions:
    PermissionListReturns one or all the permissions declared by the application.
    PermissionRequestPrompts the user to grant an application permission.
  • The Permission type:
    PermissionThe Permission type represents a permission requested by the application (and therefore declared in the manifest).
Versión mínima requerida
  • Versión 26
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local