Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

Hot Code Push

Improve this doc

HotCodePush plugin for Cordova that supports iOS and Android. This plugin allows you to keep your html, css and js files synced with your server.

For more info, please see the detailed wiki https://github.com/nordnet/cordova-hot-code-push/wiki

Repo: https://github.com/nordnet/cordova-hot-code-push

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-hot-code-push
    $ npm install --save @ionic-native/hot-code-push@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { HotCodePush } from '@ionic-native/hot-code-push';

constructor(private hotCodePush: HotCodePush) { }

...

hotCodePush.fetchUpdate(options).then(data => { console.log('Update available'); });

Instance Members

requestApplicationUpdate(message)

Show dialog with the request to update application through the Store (App Store or Google Play).

Param Type Details
message string

Message to show in the dialog

Returns: Promise<any> Resolves when the user is redirected to the store, rejects if the user declines.

fetchUpdate(options)

Download updates from the server-side.

Param Type Details
options HotCodePushRequestOptions

Additional options to the request. If not set - preferences from config.xml are used.

Returns: Promise<any> Resolves if there is an update available, rejects otherwise.

installUpdate()

Install update if there is anything to install.

Returns: Promise<any> Resolves when the update is installed.

isUpdateAvailableForInstallation()

Check if update was loaded and ready to be installed.

Returns: Promise<HotCodePushUpdate> Resolves if an update is ready, rejects if there is no update.

getVersionInfo()

Gets information about the app’s versions.

Returns: Promise<HotCodePushVersion> Resolves with the information about the versions.

onUpdateIsReadyToInstall()

Event sent when new release was successfully loaded and ready to be installed.

Returns: Observable<HotCodePushEventData>

onUpdateLoadFailed()

Event sent when plugin couldn’t load update from the server. Error details are attached to the event.

Returns: Observable<HotCodePushEventData>

onNothingToUpdate()

Event sent when we successfully loaded application config from the server, but there is nothing new is available.

Returns: Observable<HotCodePushEventData>

onBeforeInstall()

Event sent when an update is about to be installed.

Returns: Observable<HotCodePushEventData>

onUpdateInstalled()

Event sent when update was successfully installed.

Returns: Observable<HotCodePushEventData>

onUpdateInstallFailed()

Event sent when update installation failed. Error details are attached to the event.

Returns: Observable<HotCodePushEventData>

onNothingToInstall()

Event sent when there is nothing to install. Probably, nothing was loaded before that.

Returns: Observable<HotCodePushEventData>

onBeforeAssetsInstalledOnExternalStorage()

Event sent when plugin is about to start installing bundle content on the external storage.

Returns: Observable<HotCodePushEventData>

onAssetsInstalledOnExternalStorage()

Event sent when plugin successfully copied web project files from bundle on the external storage. Most likely you will use it for debug purpose only. Or even never.

Returns: Observable<HotCodePushEventData>

onAssetsInstallationError()

Event sent when plugin couldn’t copy files from bundle on the external storage. If this happens - plugin won’t work. Can occur when there is not enough free space on the device.

Returns: Observable<HotCodePushEventData>

API

Native

General