AeroPush

SDK

Usage & API

The JavaScript surface is small: initialise, sync, and let the crash boundary keep you safe. Everything else is a helper you rarely need.

init(config)

Call once, at module scope, before your component tree renders.

tsx
AeroPush.init({
  appKey: 'apk_live_…',            // required — from the dashboard
  channel: 'production',           // default: 'production'
  serverUrl: 'https://aeropush.tech', // default; set for a self-hosted server
});
OptionDefaultNotes
appKey—Required. Your app key.
channelproductionWhich channel to pull from.
serverUrlhttps://aeropush.techOrigin or …/v1/api base. Set when self-hosting.
appUpdateTestModefalseTesting only. Lets store update prompts show on a build you installed directly. Ignored on real store installs, so it’s safe to ship with.

sync(options)

Checks for a compatible update, downloads and stages it. Safe to call on every launch. Returns a SyncStatus.

tsx
await AeroPush.sync({ installMode: InstallMode.ON_NEXT_RESTART });

Install modes

ModeBehaviour
ON_NEXT_RESTART (default)Download silently; apply on the next cold launch.
ON_NEXT_RESUMEDownload silently; apply when the app next foregrounds.
IMMEDIATEDownload, then reload the JS runtime right away.

AeroPushBoundary

Wrap your app so a render crash marks the current bundle as failed, and a successful mount marks it healthy. This is the JS layer of the crash guard.

tsx
import AeroPush, { AeroPushBoundary } from 'react-native-aeropush';

export default function App() {
  return (
    <AeroPushBoundary>
      <YourApp />
    </AeroPushBoundary>
  );
}
Important
Not using the boundary? Call AeroPush.markBundleHealthy() after a successful mount, or the native launch counter rolls the bundle back after 3 launches.

Helpers

MethodReturnsNotes
markBundleHealthy()Promise<void>Reset the launch counter — the current bundle is good.
getCurrentVersion()Promise<number>The active OTA bundle version (0 = embedded).
rollback()Promise<void>Manually revert to the previous good bundle.
restart()voidReload the JS runtime now.
getAppUpdate()AppUpdateInfo | nullThe pending store update prompt, if any.
subscribeAppUpdate(fn)() => voidCalled whenever that changes. Returns an unsubscribe.

How the crash guard works

Three independent layers roll a bad bundle back without you writing any recovery code:

  • Native launch counter — increments before the bundle loads; reset on a healthy mount. Three launches without a reset triggers a rollback before JS even runs, so it catches native-level crashes too.
  • JS global handler — an uncaught JS error marks the bundle failed.
  • React error boundary — AeroPushBoundary catches render crashes.

Publishing bundles from your terminal or CI? See the CLI reference.