AppDownload Method (CLIENT)
PLB Web Only, 9.9
The AppDownload method transfers a file from the PWS server to the client application. The method uses the following format:
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
object
Required. A CLIENT object.
return
Optional. A Numeric Variable that returns the success or failure of the method.
url
Required. A Character String Variable or string literal giving the URL of the file to download from the PWS server.
filename
Required. A Character String Variable or string literal giving the file name to use on the client mobile device 'Local Application Area'.
options
Optional. A Character String Variable or string literal that specifies a JSON object that is passed directly to the Cordova routine used for this method.
Flags Affected: OVER, ZERO
Note the following:
This method is only used for a Sunbelt PL/B Web Client App using Cordova\PhoneGap operations. See the following link for details on the Cordova plugin used:
https://www.npmjs.com/package/cordova-plugin-file-transfer
The ZERO flag is set when the {return} value is zero.
The OVER flag is set if the value returned is too large to be stored into the {return} variable.
The {options} parameter controls the behavior of the Cordova plugin when the AppDownload method operation is being performed. The {options} parameter is passed directly as a JSON object to the Cordova routine. The {options} parameter currently only supports headers (such as Authorization (Basic Authentication), etc). See the plugin documentation for more information.
This method starts an asynchronous download of a file from the PWS server to the client and store in the 'Local Application Area' on the mobile device. The return result for the 'AppEventDoDownload' event data is returned in ARG1 in JSON notation.
The event number used in EVENTREG is:
The event result is defined as follows:
Alert Dialog
|
Field |
Description |
|
ARG1 |
No data returned on event. |
|
Modifier |
The button number (always 1) |
Confirm Dialog
|
Field |
Description |
|
ARG1 |
No data returned on event. |
|
Modifier |
The button number |
Prompt Dialog
|
Field |
Description |
|
ARG1 |
Prompt edit text data returned as plain text (i.e., not JSON). |
|
Modifier |
The button number |
Example Code
See Also: CLIENT, Client Methods, Method Syntax
![]() |