AppManager LiveSync API Reference

This document describes the AppManager LiveSync JavaScript API.

Class: AppManagerLiveSync

This represents the AppManager LiveSync plugin and provides properties for inspecting the currently installed update version, and methods for retrieving and installing active updates from the server.

Name Description
AppManagerLiveSync.version Returns a string of the version of the currently installed update, if any. Otherwise, returns an empty string.
AppManagerLiveSync.tryUpdate(successCallback, errorCallback) Checks for updates and prompts the user to install the update, if available.
AppManagerLiveSync.getActiveUpdate(successCallback, errorCallback) Gets information about the latest available update from the server.
AppManagerLiveSync.applyActiveUpdate(customOptions, customOptions.showProgress, successCallback, errorCallback) Applies the latest active update from the server, if any.
AppManagerLiveSync.options(customOptions, successCallback, errorCallback) Modifies the default update user interface.

Back to Top

AppManagerLivesync.version

(Property)

Returns a string of the version of the currently installed update, if any. Otherwise, returns an empty string.

Back to Top

AppManagerLiveSync.tryUpdate(successCallback, errorCallback)

(Method)

Checks for updates and prompts the user to install the update, if available.

This method uses the default user interface, provided by the plugin. To customize the user interface, call the appManagerLiveSync.options() method first.

Parameters

Name Type Description
successCallback function The function to call when the update is applied, the update is canceled by the user or app is up-to-date.
errorCallback function The function to call when the update fails.

Example

var customOptions = {
 acceptUpdateText: "Accept",
 declineUpdateText: "Decline",
 mandatoryUpdateText: "Critical update available for this app. Please install it immediately."
};

var onSuccess = function() {
 appManagerLiveSync.tryUpdate(function onSuccessUpdate(newVersion) {
                                 alert("App updated to: " + newVersion);
                             },
                             function onErrorUpdate(err) {
                                 alert(err);
                             });
};

var onError = function(err) { alert(err) };

appManagerLiveSync.options(customOptions, onSuccess, onError);

Back to Top

AppManagerLiveSync.getActiveUpdate(successCallback, errorCallback)

(Method)

Gets information about the latest available update from the server.

Parameters

Name Type Description
successCallback function The function to call when the update information is retrieved successfully.
errorCallback function The function to call when the update information cannot be retrieved.

Example

var onSuccess = function(data) {
if (data.version != appManagerLiveSync.version) {

    // You can show a custom progress dialog here

    appManagerLiveSync.applyActiveUpdate(function onSuccessUpdate(newVersion) {

                                            // You can hide the custom progress dialog here

                                            alert("App updated to: " + newVersion);
                                        },
                                        function onErrorUpdate(err) {
                                            alert(err);
                                        });
 }
};

var onError = function(err) { alert(err) };

appManagerLiveSync.getActiveUpdate(onSuccess, onError);

Back to Top

AppManagerLiveSync.applyActiveUpdate(customOptions, customOptions.showProgress, successCallback, errorCallback)

(Method)

Applies the latest available update from the server, if any.

Parameters

Name Type Description
customOptions Object Optional. A key-value object to customize the operation. See AppManagerLiveSync.options for the list of available keys.
customOptions.showProgress Boolean Optional. If specified, shows the progress user interface, provided by the plugin.
successCallback Function The function to call when the update is applied.
errorCallback Function The function to call when the update fails, the update is canceled by the user or the app is up-to-date.

Example

var onSuccess = function(data) {
if (data.version != appManagerLiveSync.version) {

 // visualize custom progress dialog if necessary here

    appManagerLiveSync.applyActiveUpdate(function onSuccessUpdate(newVersion) {

                                            // You can hide the custom progress dialog if necessary

                                            alert("App updated to: " + newVersion);
                                        },
                                        function onErrorUpdate(err) {
                                            alert(err);
                                        });
 }
};

var onError = function(err) { alert(err) };

appManagerLiveSync.getActiveUpdate(onSuccess, onError);

Back to Top

AppManagerLiveSync.options(customOptions, successCallback, errorCallback)

(Method)

Sets custom values for the messages of the default update user interface provided by the plugin.

Parameters

Name Type Description
customOptions Object A key-value object containing all strings available for customization.
customOptions.updateAvailableTitle String Specifies the title of the Update Available dialog.
customOptions.optionalUpdateText String Specifies the text in the Update Available dialog, if the update is optional.
customOptions.mandatoryUpdateText String Specifies the text in the Update Available dialog, if the update is mandatory.
customOptions.acceptUpdateText String Specifies the label for the confirmation button in the Update Available dialog.
customOptions.declineUpdateText String Specifies the label for the decline button in the Update Available dialog, if the update is optional.
customOptions.cancelDownloadText String Specifies the label for the cancellation button in the Download Progress dialog.
customOptions.downloadProgressTitle String Specifies the title of the Download Progress dialog.
customOptions.downloadProgressText String Specifies the text in the the Download Progress dialog.
customOptions.unpackApplicationText String Specifies the text in the Unpack Application dialog.
successCallback Function The function to call when the options are set successfully.
errorCallback Function The function to call when the options are not set.

Example

var customOptions = {
 acceptUpdateText: "Accept",
 declineUpdateText: "Decline",
 mandatoryUpdateText: "Critical update available for this app. Please install it immediately."
};

var onSuccess = function() {
 appManagerLiveSync.tryUpdate(function onSuccessUpdate(newVersion) {
                                 alert("App updated to: " + newVersion);
                             },
                             function onErrorUpdate(err) {
                                 alert(err);
                             });
};

var onError = function(err) { alert(err) };

appManagerLiveSync.options(customOptions, onSuccess, onError);

Back to Top

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.