{dialog.object}instantUpdateCheckForUpdate Method


{dialog.object}.instantUpdateCheckForUpdate(successCallback, errorCallback);



The JavaScript function to call if an update is available. This function will be passed an object that includes a result property that indicates whether or not an update is available.


The JavaScript function to call if an error occurs while checking for updates. This function will be passed an error object or string depending on the error.


Checks for updates for a PhoneGap app with Instant Update.


This method allows you check if an update is available in a PhoneGap application that was build with the Instant Update feature enabled. Since this is an asynchronous operation, you need to provide the JavaScript success and the error callback functions.

If a result is returned within a 5 second time-frame, the successCallback is called and passed an object with a result property that will be either true or false. If true, an update is available. If a timeout or any other error occurs the errorCallback is passed an error object or a string, depending on the error.

This method can be useful if you have turned off auto updates and want to programmatically check if an update is available.

var _successCallbackFunction = function(e) { 
    if(!e.result) { 
        //there is no update available
        alert('You are running the latest version');
        return false;
    }'Notice','<div style="height: 1in; padding: 15pt;">An update for this application is available. 
    Click OK to install the update.</div>',
    [{name: 'ok', html: 'OK', value: 'ok'}],
    function(button) {if(button == 'ok') {
        setTimeout(function() {
            {dialog.object}.instantUpdateRefresh() //install the update
        }, 10)

var _errorCallbackFunction = function() { 
    alert('Could not determine if an update is available.');

{dialog.object}.instantUpdateCheckForUpdate(_successCallbackFunction, _errorCallbackFunction);


PhoneGap Applications with Instant Update Only

See Also