ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Mobile specific functions / Download functions
  • Properties specific to DownloadInfo 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
The DownloadInfo type is used to read the different details about a download in progress retrieved by DownloadGetInfo. The characteristics of this download can be identified 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(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 DownloadInfo variables

The following properties can be used to get the details of a download:
Property nameType usedEffect
DescriptionCharacter stringDownload description displayed in the notification (if enabled).
DestinationURI variablePhysical address where the file will be stored.
FileSize8-byte integerFile size in bytes.
IdentifierIntegerIdentifier of the download in the download manager.
Progress8-byte integerNumber of bytes downloaded.
SourceURI variablehttp/https address of the file being downloaded.
StatusInteger constantDownload status:
  • downloadStatusFailed: The download failed. The StatusDetails property can be used to get more details.
  • downloadStatusPending: Pending download.
  • downloadStatusRunning: The download is in progress.
  • downloadStatusPaused: Paused download. The StatusDetails property can be used to get more details.
  • downloadStatusSuccessful: Download successful.
StatusDetailsIntegerStatus details.
If the Status property is set to downloadStatusFailed, the StatusDetails property can be used to get the RFC 2616 error code, if it was received.
Otherwise, it will correspond to one of the following constants:
  • downloadErrorInsufficientSpace: Insufficient storage space.
  • downloadErrorFileAlreadyExists: The URI points to an existing file.
  • downloadErrorUnknown: Unknown error.
  • downloadErrorStorage: Storage error.
  • downloadPausedWaitingToRetry: The download was paused due to a network error. The system will wait before trying again.
  • downloadPausedWaitingForWifi: The download is paused until a Wi-Fi network is found.
  • downloadPausedWaitingForNetwork: The download is paused until a network is found.
  • downloadPausedUnknown: The download is paused for an unknown reason.
TitleCharacter stringDownload title displayed in the notification (if enabled).
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: 06/22/2023

Send a report | Local help