The Pro Client gives you access to everything you need to make these modifications,
and it’s recommended that you always use the Pro Client instead of the Cordova plugin directly.

Note: Async Await vs. ".then()"

In all of the examples on this page you'll notice that we use Async/Await.
This automatically resolves promises inline for you and waits to perform the next action.
This is just an alternative to using `.then`. Async/Await just allows your code to be much more legible
(especially when you'd normally be chaining multiple promises) as it's read like a syncronous piece of code.
Here are two ways to write the same piece of code:

Pro.deploy.getCurrentVersion().then((versionInfo)=>{console.log(versionInfo);})// is the same asasyncgetVersionInfo(){constversionInfo=awaitPro.deploy.getCurrentVersion();console.log(versionInfo);}

Using the Ionic Pro Client

The Ionic Pro Client gives you access to the Deploy API inside of your app.

Try the New Improved Deploy Plugin

We’re excited to announce that we’ve released major update to the deploy plugin and Pro Client!
The new version of the plugin was neccessary to support underlying changes to the cordova-plugin-ionic-webview
in order to support Ionic 4 and it also brings with it a number of optimizations that we know users have been looking
forward to for a long time and lays the foundation for more! The major updates include:

CDN - The new deploy plugin is backed by a CDN so that files are cached close to your users in edge locations
and will reduce download times

Differential Updates - The previous version of the plugin shipped all the assets in you built www directory for every
update. The new one only downloads files that have changed since the previous versions stored on the device which can reduce
bandwidth by up to 90% and should increase download speeds as well.

OnResume Updates - Now users will be able to recieve app updates on resuming the app after it has been in the background for
a long enough period of time. Previously updates were only installed if the app was fully closed and reopened now you can use the
MIN_BACKGROUND_DURATION plugin variable to control how long the app needs to be in the background before
the plugin considers it “closed” for the purposes of checking for an update.

sync

description: This function performs an entire standard check, download, extract, and reload cycle rather than having to program it yourself. This should be used most of the time unless you need to customize the flow.

Returns:Promise<SnapshotInfo| undefined> - The info of the currently applied update or undefined if there is no applied update.

asyncperformAutomaticUpdate(){try{constcurrentVersion=Pro.deploy.getCurrentVersion();constresp=awaitPro.deploy.sync({updateMethod:'auto'});if(currentVersion.versionId!==resp.versionId){// We found an update, and are in process of redirecting you since you put auto!}else{// No update available}}catch(err){// We encountered an error.// Here's how we would log it to Ionic Pro Monitoring while also catching:// Pro.monitoring.exception(err);}}

versionId

CallbackFunction

Callable

Plugin Variables

When installing cordova-plugin-ionic there are a number of variables you can install the plugin with to configure the behavior of the plugin and how
updates are applied to your app by using the --variable flag.

APP_ID - Required

The APP_ID variable sets app in the pro dashboard the plugin should check for updates.
The App ID can be updated at runtime via the Deploy Pro Client.

CHANNEL_NAME - Required

The CHANNEL_NAME variable sets which channel the plugin should check for updates.
The Channel can be updated at runtime via the configure method of the Deploy Pro Client.

UPDATE_METHOD

Default: background

The UPDATE_METHOD determines how updates are applied to your app.
When you are installing the Ionic Pro plugin, you have the option to choose which update method to use.
The three options are:

background - mode will check for updates when a user first opens your app from a completely closed state
(in the splashscreen) or after a user resumes the app from the background after the minimum duration.
It will download the update in the background while the user is using your app.
The next time they close and open your app, we will apply the updated version.
You can still perform updates yourself and override the update method using the
Deploy Pro Client as well.

auto - mode will check for updates when a user first opens your app from a completely closed state (in the splashscreen)
or after a user resumes the app from the background after the minimum duration.
It will then WAIT on the splashscreen until the new update is downloaded, and immediately show the user the new version of the code after the splashscreen.
Using this method essentially forces users to always use the most up to date version when connected to the internet
with the trade off that users may wait on the splashscreen longer before interacting with the app while waiting for an update.
You can still perform updates yourself and override the update method using the
Deploy Pro Client as well.

none - will not automatically apply or download updates for you.
Instead you have to manage the entire update process yourself using the Deploy Pro Client.
This isn’t recommended as if you deploy an update that “breaks” your app and can no longer apply Deploy updates,
you will have to release a native binary in order to fix the issue or the user will have to delete and reinstall your app.
Using the background or auto methods protects you by applying updates in the native layer.

MAX_STORE

Default: 2

The MAX_STORE variable can be configured to tell the deploy plugin how many updates to keep around locally on the device.
Keeping more versions around locally makes rolling back faster but takes up more room on the device.

MIN_BACKGROUND_DURATION

New in v5 RC

Default: 30

The MIN_BACKGROUND_DURATION variable sets the minimum number of seconds the user needs to put the app in the background before
the plugin considers the app closed and checks for an update on resume like it would on a fresh app open according to the specified
update method.

Plugin Preferences

DisableDeploy

Default: false

Allows to disable deploy updates by adding this preference in the config.xml

<preference name="DisableDeploy" value="true" />

After adding be sure to run cordova prepare [platform] in order for changes to take effect.