Wednesday, May 14, 2008

nsIApplicationUpdateService

new

New page

<breadcrumbs></breadcrumbs>
The <code>nsIApplicationUpdateService</code> interface describes a global application service that handles performing background update checks. It also provides utilities for selecting and downloading update patches.

__TOC__
{{InterfaceStatus|nsIApplicationUpdateService|toolkit/mozapps/update/public/nsIUpdateService.idl|unfrozen|Mozilla 1.9|yes}}

Inherits from: {{interface|nsISupports}}

=Method overview=

{| class="standard-table"
|-
| <code>void [[#addDownloadListener()|addDownloadListener]](in [[nsIRequestObserver]] listener);</code>
|-
| <code>[[AString]] [[#downloadUpdate()|downloadUpdate]](in [[nsIUpdate]] update, in boolean background]] listener);</code>
|-
| <code>void [[#pauseDownload()|pauseDownload]]();</code>
|-
| <code>void [[#removeDownloadListener()|removeDownloadListener]](in [[nsIRequestObserver]] listener);</code>
|-
| <code>[[nsIUpdate]] [[#selectUpdate()|selectUpdate]]([array, size_is(updateCount)] in nsIUpdate updates, in unsigned long updateCount);</code>
|-
|}

=Attributes=

{| class="standard-table"
|-
| class="header"|Attribute
| class="header"|Type
| class="header"|Description
|-
|-
|<code>backgroundChecker</code>
|<code>[[nsIUpdateChecker]]</code>
|The update checker being used for background update checking; '''read only'''.
|-
|<code>isDownloading</code>
|<code>boolean</code>
|<code>true</code> if a download is in progress, otherwise <code>false</code>. '''Read only'''.
|-
|<code>canUpdate</code>
|<code>boolean</code>
|<code>true</code> if the update service is able to download and install updates. This depends on whether or not the current user has the necessary access privileges for the install directory.
|-
|}

=Methods=

==addDownloadListener()==
Adds a listener that receives progress and state information about the update that is currently being downloaded. This information is most commonly used to update a user interface that informs the user as to the status of an update.

void addDownloadListener(
in nsIRequestObserver listener
);

<h5>Parameters</h5>

;<tt>listener</tt>
:An object implementing {{interface|nsIRequestObserver}} and optionally {{interface|nsIProgressEventSink}} that will be notified of state and progress information as the update is downloaded.

==downloadUpdate()==
Starts downloading a software update.

AString downloadUpdate(
in nsIUpdate update,
in boolean background
);

<h5>Parameters</h5>

;<tt>update</tt>
:An {{interface|nsIUpdate}} object indicating the update to download.
;<tt>background</tt>
:<code>true</code> to download the update in the background or <code>false</code> to download it in the foreground.

<h5>Return value</h5>

A string indicating the status of the update upon return:

;"downloading"
:The update is being downloaded.
;"pending"
:The update is ready to be applied.
;"applying"
:The update is in the process of being applied.
;"succeeded"
:The update has been installed successfully.
;"download-failed"
:The update failed to be downloaded.
;"failed"
:Installing the update failed.

==pauseDownload()==
Pauses the currently active update download.

void pauseDownload();

<h5>Parameters</h5>

None.

==selectUpdate()==
Selects the best update to install from a provided list of available updates.

nsIUpdate selectUpdate(
[array, size_is(updateCount)] in nsIUpdate updates,
in unsigned long updateCount
);

<h5>Parameters</h5>

;<tt>updates</tt>
:An array of updates that are available to install.
;<tt>updateCount</tt>
:The number of updates in the <tt>updates</tt> array.

<h5>Return value</h5>

An {{interface|nsIUpdate}} object indicating the most appropriate update to install.

=See also=

* {{interface|nsIUpdate}}
* {{interface|nsIUpdateCheckListener}}
* {{interface|nsIUpdateChecker}}
* {{interface|nsIUpdatePatch}}
* {{interface|nsIUpdateManager}}
* {{interface|nsIUpdatePrompt}}
* {{interface|nsIUpdateTimerManager}}

[[Category:Interfaces]]