PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
New WINDEV Mobile 27 feature!
  • Properties specific to the description of DownloadParameter variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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 modified 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.
Example
// 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(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 the description of DownloadParameter variables

The following properties can be used to handle the characteristics of a download:
Property nameType usedEffect
DescriptionCharacter stringDownload description displayed in the notification (if enabled).
Remark: This property is optional.
DestinationCharacter stringPhysical 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.
RequiresChargingBoolean
  • True if the download requires the phone to be charging,
  • False (default value) otherwise.
HeaderArray of character stringsUsed to add a header to the download request. The following syntax must be used:
<Variable name>.HTTPHeader["Header name"] =
"Value of header"
RoamingAllowedBoolean
  • True (default) if data roaming can be used for the download.
  • False otherwise.
NotificationModeInteger constantDownload 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.
ProcedureEndGlobal procedure onlyName 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.
MobileNetworkAllowedBoolean
  • True (default value) if the mobile network can be used for the download.
  • False otherwise.
MeteredNetworkAllowedBoolean
  • 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.
SourceURI variablehttp/https address of the file to be downloaded.
TitleCharacter stringDownload 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.
Minimum version required
  • Version 27
Comments
Click [Add] to post a comment