LiveUpdateManager

The Live Update Manager is used to manage instances of web apps used with Live Updates. It follows a Singleton Pattern to allow access from anywhere in the application. Use the Live Update Manager to configure and run sync to update web apps, check the status of an active sync, and get the file path of the latest web assets on the device.

Functions

Link copied to clipboard

Adds an app to the LiveUpdateManager.

Link copied to clipboard
fun applyUpdate(context: Context, appId: String, snapshotId: String, buildId: String)

Apply a downloaded and extracted Live Update snapshot to the portal for next load.

Link copied to clipboard

Cancel all running sync jobs

Attempts to cancel a running sync job

Link copied to clipboard

Synchronous function to check for an update for an app.

fun checkForUpdate(context: Context, appId: String, callback: CheckCallback)

Asynchronous function to check for an update for an app.

Link copied to clipboard

Clean up any stale app versions. Stale versions are any app snapshot files built for previous versions of the app binary and not currently used by any app channel.

Link copied to clipboard

Clean up all unused/old app versions.

fun cleanVersions(context: Context, appId: String)

Clean up unused/old app versions related to a specific app.

Link copied to clipboard
fun downloadUpdate(context: Context, appId: String, snapshotId: String): DownloadResponse?

Synchronous function to download an update for an app.

fun downloadUpdate(context: Context, appId: String, snapshotId: String, callback: DownloadCallback)

Asynchronous function to download an update for an app.

Link copied to clipboard
fun extractUpdate(appId: String, zipFile: File): File?

Synchronous function to extract a downloaded zipped app.

fun extractUpdate(appId: String, zipFile: File, callback: ExtractCallback)

Asynchronous function to extract a downloaded zipped app.

Link copied to clipboard

Get the map of all registered apps using Live Updates.

Link copied to clipboard

Check the latest time any of the registered apps was synced.

fun getLastSync(context: Context, appId: String): Long

Check when an app was last synced.

Link copied to clipboard

Get the latest directory for the updated app resources, if available. If the app has not been updated through Live Updates, null will be returned.

Link copied to clipboard

Initializes the file directory and shared preferences used to save update data.

Link copied to clipboard

Configure logging output for the Live Updates library. This is enabled by default. If set to false, logging is disabled and should not print to console.

Link copied to clipboard
fun reset(context: Context, retainCache: Boolean = false)

Clears the live updates directory and saved update data. Attempts to cancel any running sync jobs.

Link copied to clipboard
fun setCustomUrl(context: Context, token: String)

Sets a custom URL for the Live Update Manager to use for syncing. This uses a token provided by Ionic/Outsystems for configuration.

Link copied to clipboard
fun sync(context: Context, callback: SyncCallback? = null)

Checks with live updates to see if any new builds are available. If they are, attempt to download, unzip, and update the saved data to reference the latest build.

fun sync(context: Context, appId: String, callback: SyncCallback? = null)

Checks a single app with live updates to see if any new builds are available. If they are, attempt to download, unzip, and update the saved data to reference the latest build.

fun sync(context: Context, appIds: Array<String> = arrayOf(), async: Boolean = true, callback: SyncCallback? = null)

Checks all apps or a provided set of apps with live updates to see if any new builds are available. If they are, attempt to download, unzip, and update the saved data to reference the latest build.

Link copied to clipboard
fun verifyUpdate(context: Context, appId: String, updatePath: File): Boolean

Verify a downloaded Live Update if it is configured to use Secure Live Updates.

Properties

Link copied to clipboard
var maxVersions: Int = 3

The maximum number of updates per app instance to be stored locally on the device.

Link copied to clipboard

The name of the file containing the public key used to validate Secure Live Updates.