|
|
|
|
|
- Properties specific to DownloadParameter variables
DownloadParameter (Type of variable) In french: TéléchargementParamètre
The DownloadParameter type is used to define all the advanced characteristics of a file download performed by DownloadAdd. The characteristics of this download can be defined and changed using different WLanguage properties. Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable. // Procedure to call at the end of the download PROCÉDURE DownloadCompleted(InfoDownload is DownloadInfo) IF InfoDownload.Status = downloadStatusSuccessful THEN   Info(InfoDownload.Title + " has been downloaded successfully."   RESULT False END   // --------------- // Create a DownloadParameter variable // to store the download information ParameterDownload is DownloadParameter  // Specify the parameters of the download ParameterDownload.Source = ... "https://windev.com/storage/en_US/img/visual/25/logo-pcsoft.png" ParameterDownload.Title = "PC Soft Logo" ParameterDownload.Description = "PC Soft company logo" ParameterDownload.Destination = SysDirExternalStorage(1, sseAppDownload) ParameterDownload.MobileNetworkAllowed = True ParameterDownload.MeteredNetworkAllowed = False ParameterDownload.RequiresCharging = True ParameterDownload.NotificationMode = downloadNotifProgressAndCompletion // Procedure to call at the end of the download ParameterDownload.ProcedureEnd = "DownloadCompleted"  // The download is added to the list of downloads to be started // (The download manager will start the download as soon as possible). nID is int = DownloadAdd(ParameterDownload)  telInfo is DownloadInfo = DownloadGetInfo(nID)  Info(telInfo.Title)
Remarks Properties specific to DownloadParameter variables The following properties can be used to handle the characteristics of a download: | | | Property name | Type used | Effect |
---|
Description | Character string | Download description displayed in the notification (if enabled). Remark: This property is optional. | Destination | Character string | Physical address where the file will be stored. The path must correspond to: - the external storage of the device,
- the folders of the application,
- the public downloads folder, accessible by calling SysDirExternalStorage with the ssePublicDownload constant.
If no destination is specified or if this property is an empty string, the file will be downloaded to the public downloads folder.Remark: This property is optional. | Header | Array of character strings | Used to add a header to the download request. The following syntax must be used:
<Variable name>.HTTPHeader["Header name"] = "Value of header" | MeteredNetworkAllowed | Boolean | - True (default) if the download can be done over a metered network. A metered network means a network that has a cost to the user, has a data limit or has performance or battery issues.
- False otherwise.
| MobileNetworkAllowed | Boolean | - True (default value) if the mobile network can be used for the download.
- False otherwise.
| NotificationMode | Integer constant | Download notification mode: - downloadNotifNone: No notifications shown.
Remark: this constant requires adding the DOWNLOAD_WITHOUT_NOTIFICATION permission. - downloadNotifProgress (Default value): A notification shows the progress of the download and disappears when the download is complete.
- downloadNotifProgressAndCompletion: A notification shows the progress of the download and remains visible when the download is complete.
| ProcedureEnd | Global procedure only | Name of the procedure to be called at the end of the download whether it is completed or canceled: - If the application is not started the download is completed, the system starts the application to execute the procedure.
- If the procedure returns True, the download will be removed and the downloaded file will be deleted.
| RequiresCharging | Boolean | - True if the download requires the phone to be charging,
- False (default value) otherwise.
| RoamingAllowed | Boolean | - True (default) if data roaming can be used for the download.
- False otherwise.
| Source | URI variable | http/https address of the file to be downloaded. | Title | Character string | Download title displayed in the notification (if enabled). If this property is not specified or is an empty string (""), a default title based on the name of the downloaded file will automatically be used. |
Related Examples:
|
Android (WINDEV Mobile): Android Downloads
[ + ] This example illustrates background downloads in WINDEV Mobile and Android. It is no longer necessary to keep the application open to propose the download of a file. The download manager allows you to download large files and to notify the application when the downloads are finished.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|