Controlling binary data upload with API methods
When you develop a Pega Platform™ mobile app, you can make it possible for mobile app users to pause and resume binary data upload. As a result, mobile app users can process their work items without having to wait for synchronization to finish or they can postpone large file uploads until they are in an area with better connectivity. The JavaScript API of the Pega Mobile Client™ provides the following methods that you can use to monitor and control binary data upload:
window.pms.plugins.clientstore.getFileForwardingState
– Retrieves a state of the file forwarding process. This method returns a promise object. When the promise object is in the resolve state, it returns a Boolean value that corresponds to the state of the forwarding process.window.pms.plugins.clientstore.setFileForwardingState
– Sets the state of the file forwarding process. This method has a Boolean parameterstate
, which denotes the state of the file forwarding process. By default it is enabled. This method also returns a promise object. When the promise object is in the resolve state, it confirms that the operation has been successfully completed.
When configuring your application to enable users to pause and resume binary data upload, consider the following information:
- If the
state
parameter is set to false, and the user adds a file, Pega Mobile Client notifies the server of the action, but it does not send the file. Therefore, you cannot validate the advance case action based on file upload, because Pega Platform rejects the advance case action until the server receives the file. - If the
state
parameter is initially set to true and the user toggles its value while the file is being uploaded, the upload process pauses immediately. Data synchronization continues, but no files are uploaded. Files that have not been uploaded are persisted and are uploaded after the flag is set to true again. For files that have been partially uploaded, the upload process resumes from where it paused. - If the
state
parameter is initially set to false and the user toggles its value while the synchronization is in process, files are not uploaded until the next synchronization session. You can call theClientStore.start
method to force binary data upload. - The value of the
state
parameter is persisted.
For more information, see Client Store and Searching device contacts with Pega Mobile Client API.