Skip to main content

Using a Live Update Provider

A Portal's live update source isn't limited to Ionic Appflow. A Live Update Provider lets a Portal sync its web assets from any other update service that supports it — whether that's a third-party update service or infrastructure your own organization runs.

note

This is for syncing Portal web assets from an update service other than Appflow. If you're using Appflow, see Adding Live Updates instead.

Install

Add your update service's SDK to your project, following that SDK's own installation instructions. It will hand you an object you can pass straight to setLiveUpdateProviderManager(...) when configuring a Portal below — there's nothing else to install.

tip

Building your own Live Update Provider integration instead of using an existing update service's SDK? See the Live Update Provider SDK documentation.

Configure

Use PortalBuilder.setLiveUpdateProviderManager(manager) in place of setLiveUpdateConfig(...), passing the object your update service's SDK gave you:

import android.app.Application
import io.ionic.portals.PortalManager

class MyApplication : Application() {
override fun onCreate(): Unit {
super.onCreate()

PortalManager.newPortal("portal1")
.setLiveUpdateProviderManager(MyUpdateService.providerManager)
.create()
}
}

A Portal can only have one live update source — configuring a provider manager this way replaces any Appflow config set via setLiveUpdateConfig(...).

caution

An Appflow source syncs automatically the first time a Portal is created or loaded, via the updateOnAppLoad flag on setLiveUpdateConfig(...). There's no equivalent flag for a provider source — Portals never calls into a provider manager on its own, so nothing happens until your app calls syncProvider()/syncProviderAsync(), as shown below. Consult your update service's SDK documentation — it may already sync in the background on its own schedule.

Syncing

Call syncProvider() (Kotlin) or syncProviderAsync() (Java) to trigger a sync manually:

val portal = PortalManager.getPortal("portal1")
val result = portal.syncProvider()

Reloading After a Sync

Reload a provider-backed Portal the same way you'd reload an Appflow-backed one — see Reload Portals with Live Updates for the pattern, substituting the syncProvider()/syncProviderAsync() call shown above wherever that guide calls LiveUpdateManager.sync(...).