|
|
|
|
|
PermissionRequest (Function) Prompts the user to grant an application permission. This function makes it possible to show an information message to the user before the permission request. // Requests permission to access precise device location // before calling GPSGetPosition Perm is Permission = PermissionList("android.permission.ACCESS_FINE_LOCATION") // If the permission has not been granted yet IF NOT Perm.Granted THEN // Information message // Shows the user a message to explain // why the application requires this permission Info("xxxx requires this permission") // Requests the permission PermissionRequest(Perm, ProcRequestPermission) INTERNAL PROCEDURE ProcRequestPermission(Perm is Permission) IF Perm.Granted THEN MyPosition is geoPosition = GPSGetPosition() ... END END END
Sintaxis
Requesting one permission Ocultar los detalles
PermissionRequest(<Permission> , <WLanguage procedure>)
<Permission>: Character string or Permission variable Name of the permission to request. This parameter can correspond to: - to a string of the form: android.permission.<NOM>. The Android SDK permissions list is available at the following address: https://developer.android.com/reference/android/Manifest.permission.
- a variable of type Permission.
- one of the following constants:
| | permBackgroundLocation | Permission to access the device's location when the application is running in the background. Warning: this permission must be requested alone, and after accepting the permissions corresponding to the constants permLocation constants or permLocalisationPrecise constants. | permCamera | Permission to access the device camera(s). | permFineLocation | Permission to access the device's precise location. | permLocation | Permission to access the device's location. | permManageExternalStorage | Permission to manage external storage. If this permission is requested, a system window will prompt the user to allow the application to access files on the external storage without restrictions. | permReadContact | Permission to read contacts. | permReadPhoneState | Permission to access phone information. | permRecordAudio | Permission to record audio streams. | permSendSMS | Permission to send SMSes. | permWriteContact | Permission to modify contacts. | permWriteExternalStorage | Permission to write on the external storage. |
<WLanguage procedure>: Procedure name Name of the WLanguage procedure ("callback") called when the permission request is approved. This procedure has the following format:
PROCEDURE <Procedure name>(<Result>) where <Result> is a Permission variable. The result of the permission request is assigned to the Granted property.
Requesting multiple permissions simultaneously Ocultar los detalles
PermissionRequest(<Permissions> , <WLanguage procedure>)
<Permissions>: Array Requested permissions. This parameter can correspond to: - to an array of strings of the form: android.permission.<NOM>
- an array of Permission variables.
<WLanguage procedure>: Procedure name Name of the WLanguage procedure ("callback") called when the permission request is approved. This procedure has the following format:
PROCEDURE <Procedure name>(<Result>) where <Result> is an array of Permission variables. For each permission, the result of the permission request is assigned to the Granted property. Observaciones - The permLocationBackground or "android.permission.ACCESS_BACKGROUND_LOCATION" permission must be requested individually and after the permLocation or permFineLocation permissions are granted.
- The permission must have been declared in the application manifest. Otherwise, a fatal error will occur.
- It is not necessary to call PermissionRequest for "normal" permissions (as opposed to "dangerous" permissions) because they are automatically granted when the application is installed, if they have been declared in the application manifest.
- For "dangerous" permissions (access to the location of the device, camera, microphone, etc.), the Android framework automatically requests the permission when a relevant feature is used. However, PermissionRequest can be used when, for example, you want to display an information message to the user before requesting a permission.
- If the permission has already been granted, no window will be displayed.
- WARNING: Since the PermissionRequest function can display a window for the user to validate the Permission request, this function must be called from the application's main thread.
- To get the list of permissions declared by the application, use PermissionList.
Clasificación Lógica de negocio / UI: Código neutro Componente: wd300android.aar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|