Skip to main content

Android Native API

This reference documents the Android native API that integrators interact with when wiring Airborne into a React Native or Expo app. All classes live in the in.juspay.airborneplugin package and are provided by airborne-react-native. For the step-by-step wiring, see Android setup (React Native) or Android setup (Expo).

Airborne

The entry point. You construct one instance in MainApplication, passing your application context, your release config URL, and an AirborneInterface implementation. Construction starts the OTA load immediately.

class Airborne(
context: Context,
releaseConfigUrl: String,
private val airborneInterface: AirborneInterface
)

Constructor

ParameterTypeDescription
contextContextThe application context (use applicationContext).
releaseConfigUrlStringThe release URL the SDK fetches the release config from, e.g. https://airborne.juspay.in/release/<organisation>/<application>.
airborneInterfaceAirborneInterfaceThe callbacks implementation. A secondary constructor Airborne(context, releaseConfigUrl) uses a default no-op AirborneInterface.

Public methods

MethodSignatureDescription
getBundlePathfun getBundlePath(): StringReturns the path of the index JS bundle. Falls back to the bundled asset path (assets://..., defaulting to index.android.bundle) when no downloaded bundle exists. Used by the React Native host's getJSBundleFile().
getFileContentfun getFileContent(filePath: String): StringReads the content of the file at filePath (relative to the package) and returns it as a string.
getReleaseConfigfun getReleaseConfig(): StringReturns the current release config as a stringified JSON.
setSslConfigfun setSslConfig(sslSocketFactory: SSLSocketFactory, trustManager: X509TrustManager)Sets a custom SSL configuration for mTLS. Call before any network requests are made to enable client-certificate authentication.

AirborneInterface

An abstract class you subclass (typically as an anonymous object) to provide your namespace and dimensions and to receive callbacks. Every method has a default implementation, so override only what you need.

abstract class AirborneInterface {
open fun getNamespace(): String
open fun getDimensions(): HashMap<String, String>
open fun startApp(indexPath: String)
open fun onEvent(level: String, label: String, key: String, value: JSONObject, category: String, subCategory: String)
open fun getLazyDownloadCallback(): LazyDownloadCallback
}

Callbacks

MethodSignatureDescription
getNamespacefun getNamespace(): StringReturns the application namespace. Must match the namespace segment of your release URL; the SDK uses it to identify and store the correct bundle. Defaults to "airborne-example".
getDimensionsfun getDimensions(): HashMap<String, String>Returns custom dimensions sent with the release config request (the x-dimension header) for targeting — e.g. app version or user segment. Defaults to an empty map.
startAppfun startApp(indexPath: String)Called when the boot completes and the bundle is ready. indexPath is the path to the index bundle to boot from. Store it and trigger your boot-complete logic.
onEventfun onEvent(level: String, label: String, key: String, value: JSONObject, category: String, subCategory: String)Receives lifecycle and error events for logging/analytics. See the callbacks & events reference for the full catalogue and field meanings.
getLazyDownloadCallbackfun getLazyDownloadCallback(): LazyDownloadCallbackReturns a LazyDownloadCallback (in.juspay.airborne) notified as lazy files install. Defaults to a no-op implementation that logs install status.

onEvent parameters

ParameterTypeDescription
levelStringSeverity level, e.g. "info", "error".
labelStringCategory label for the event, e.g. "ota_update".
keyStringThe specific event identifier, e.g. "package_update_result".
valueJSONObjectStructured payload for the event.
categoryStringThe broad category, e.g. "lifecycle".
subCategoryStringThe subcategory, e.g. "hyperota".

LazyDownloadCallback

MethodSignatureDescription
fileInstalledfun fileInstalled(filePath: String, success: Boolean)Called when an individual lazy file finishes installing, with whether it succeeded.
lazySplitsInstalledfun lazySplitsInstalled(success: Boolean)Called when all lazy splits have finished installing.

AirborneReactActivityDelegate

A DefaultReactActivityDelegate that defers loadApp until Airborne has resolved the JS bundle file, then loads the React app. Return it from createReactActivityDelegate() in MainActivity (wrapped in Expo's ReactActivityDelegateWrapper on the Expo track).

class AirborneReactActivityDelegate(
activity: ReactActivity,
mainComponentName: String,
fabricEnabled: Boolean
) : DefaultReactActivityDelegate(activity, mainComponentName, fabricEnabled)
ParameterTypeDescription
activityReactActivityThe hosting React activity (this).
mainComponentNameStringThe main component name.
fabricEnabledBooleanWhether Fabric (the New Architecture renderer) is enabled.

AirborneReactNativeHost

The React Native host that loads the bundle from Airborne's managed path. Subclass it (as an anonymous object) for your reactNativeHost, overriding getJSBundleFile() to return airborneInstance.getBundlePath(). It extends AirborneReactNativeHostBase, which itself extends DefaultReactNativeHost.

abstract class AirborneReactNativeHost(application: Application) : AirborneReactNativeHostBase(application)

Overrides you typically provide:

OverrideDescription
getJSBundleFile(): String?Return airborneInstance.getBundlePath() so React Native boots from the Airborne-managed bundle.
getJSMainModuleName(): Stringindex on plain React Native; .expo/.virtual-metro-entry on Expo.
getPackages(): List<ReactPackage>The autolinked package list.
getUseDeveloperSupport(): BooleanUsually BuildConfig.DEBUG.
isNewArchEnabled: BooleanBuildConfig.IS_NEW_ARCHITECTURE_ENABLED.

AirborneReactNativeHostBase

MemberSignatureDescription
getReactHostcompanion fun getReactHost(context: Context, reactNativeHost: ReactNativeHost): ReactHostBuilds a ReactHost wired to Airborne's host delegate. On the plain React Native track, return it from the reactHost property.

See also