ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Mobile specific functions / Download functions
  • Properties specific to DownloadParameter variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
DownloadParameter (Variable type)
In french: TéléchargementParamètre
The DownloadParameter type is used to define all the advanced characteristics of a file download performed by DownloadAdd. You can define and change the characteristics of this download using different WLanguage properties.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Procédure à appeler en fin de téléchargement
PROCEDURE FinDeTéléchargement(InfoTéléchargement is TéléchargementInfo)
IF InfoTéléchargement.Etat = downloadStatusSuccessful THEN
    Info("Le téléchargement " + InfoTéléchargement.Titre + " est terminé."
    RETURN False
END


// ---------------
// Crée une variable de type TéléchargementParamètre 
// pour enregistrer les informations du téléchargement
ParamètreTéléchargement is TéléchargementParamètre

// Spécifie les paramètres du téléchargement
ParamètreTéléchargement.Source = ...
	"https://www.pcsoft.fr/img/visuels/download.php?filename=pcsoft/logo-pcsoft.png"
ParamètreTéléchargement.Titre = "Logo PC Soft"
ParamètreTéléchargement.Description = "Logo de l'entreprise PC Soft."
ParamètreTéléchargement.Destination = SysDirExternalStorage(1, sseAppDownload)
ParamètreTéléchargement.RéseauMobileAutorisé = True
ParamètreTéléchargement.RéseauRestreintAutorisé = False
ParamètreTéléchargement.EnCharge = True
ParamètreTéléchargement.ModeNotification = downloadNotifProgressAndCompletion
// Procédure à appeler en fin de téléchargement
ParamètreTéléchargement.ProcédureFin = "FinDeTéléchargement"

// Le téléchargement est ajouté à la liste des téléchargements à effectuer
// (Le téléchargement commencera dès que le gestionnaire de téléchargement pourra le lancer).
nID is int = DownloadAdd(ParamètreTéléchargement)

telInfo is TéléchargementInfo = DownloadGetInfo(nID)

Info(telInfo.Titre)
Properties

Properties specific to 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).
Note: 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.
Note: This property is optional.
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"
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.
MobileNetworkAllowedBoolean
  • True (default value) if the mobile network can be used for the download.
  • False otherwise.
NotificationModeInteger constantDownload notification mode:
  • downloadNotifNo Notification is not visible.
    Note: use of this constant requires the addition of the DOWNLOAD_WITHOUT_NOTIFICATION permission.
  • downloadProgressionNotification (Default value): As long as the download is in progress, a notification shows the progress and disappears when the download is complete.
  • downloadProgressNotificationEnd While the download is in progress, a notification shows the progress 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.
RequiresChargingBoolean
  • True if the download requires the phone to be charging,
  • False (default value) otherwise.
RoamingAllowedBoolean
  • True (default) if data roaming can be used for the download.
  • 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.
Related Examples:
Android Downloads 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.
Minimum version required
  • Version 27
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help