|
|
|
|
- Operating mode
- Handling background tasks
- Android specific features
- Specific features for iOS
BackgroundTaskAdd (Function) Adds a new background task. This task will be performed periodically when the application is stopped or when it is running in the background.
BackgroundTaskAdd(ProcTraitementEmailEnArrièrePlan, 24*60)
PROCEDURE ProcTraitementEmailEnArrièrePlan()
n is int = TraiteEmailRecus()
IF n > 0 THEN
notif is Notification
notif.Title = "Traitement des emails terminés"
notif.Message = StringBuild("%1 emails ont été traités", n)
NotifAdd(notif)
END
Sintaxis
<Result> = BackgroundTaskAdd(<WLanguage procedure> [, <Time interval> [, <Option>]])
<Result>: Integer - Identifier of added task,
- 0 if an error occurs. To get more details on the error, use ErrorInfo.
<WLanguage procedure>: Procedure name WLanguage procedure ("callback" procedure) called when running the task. This procedure must be a global procedure of project and it must expect no parameter. Otherwise, a fatal error will occur during the call to BackgroundTaskAdd. <Time interval>: Optional integer Minimum time interval (expressed in minutes) between two task executions. Used to guarantee that the task will not be run during this time interval. On the other hand, the system can increase the interval time depending on various factors (heavy use, weak battery, etc.).. Therefore, the real time interval can change and it can be quite long (several hours). By default: - the time interval between two task executions is set to 1 hour.
- the minimum time interval allowed is set to 15 minutes.
This parameter can be: - an integer corresponding to the number of minutes,
- a Duration variable,
- the duration in a readable format (e.g., '20min').
<Option>: Optional Integer constant Novedad versión 2024
Observaciones Operating mode Once added, the background task is automatically run by the system at regular time interval. The task is persistent, it will continue to be run periodically when the application is stopped, even when the device is restarted. If the task is triggered while the application is not started, the application will be run in background (without opening the first project window), the initialization process of project and the declaration process of classes and sets of procedures will be run before calling the procedure associated with the task. The task will be run when the application is not started or when the application is in background. If the application is displayed in the foreground, its execution will be postponed. As the task can be run in a secondary thread of the application, the code of the WLanguage procedure must not contain an access to the application's UI or open dialog boxes (via Info, Error, etc.). If the task must interact with the users, you can use notifications ( Notifxxx functions). Handling background tasks - From the editor, you can specify that a procedure must be run in background task by enabling the corresponding option from the setting window of procedure automation. The task will be automatically added during the next application start: In this case, it is not necessary to call BackgroundTaskAdd.
Clasificación Lógica de negocio / UI: Lógica de negocio Componente: wd290android.jar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|