Skip to main content

App Update — Types

Two TypeScript interfaces define the App Update API surface. Both are exported from the package root:

import type { AppUpdateInfo, OpenAppStoreOptions } from 'native-update';

AppUpdateInfo

The result of getAppUpdateInfo(). Most fields are optional because the underlying Play Core / iTunes lookup APIs only populate them in certain conditions.

FieldTypeRequiredDescription
updateAvailablebooleanyestrue if a newer binary version exists in the store.
currentVersionstringyesVersion of the currently installed binary, as reported by the platform.
availableVersionstringnoVersion available in the store (only when updateAvailable is true).
updatePrioritynumbernoPlay priority 0–5. Always populated on Android when an update is available; never populated on iOS / web. See Update priorities.
immediateUpdateAllowedbooleannoAndroid: true if the priority + freshness rules permit performImmediateUpdate(). Always false on iOS / web.
flexibleUpdateAllowedbooleannoAndroid: true if startFlexibleUpdate() is permitted. Always false on iOS / web.
clientVersionStalenessDaysnumbernoDays since the user's installed version was the latest. Useful for "your app is N days behind" UI.
installStatusInstallStatusnoPopulated when a flexible update is mid-flight.
bytesDownloadednumbernoCumulative bytes downloaded for an in-progress flexible update.
totalBytesToDownloadnumbernoTotal bytes for the in-progress flexible update.
const info: AppUpdateInfo = await NativeUpdate.getAppUpdateInfo();
// {
// updateAvailable: true,
// currentVersion: '1.2.3',
// availableVersion: '1.2.4',
// updatePriority: 4,
// immediateUpdateAllowed: true,
// flexibleUpdateAllowed: true,
// clientVersionStalenessDays: 12,
// installStatus: undefined,
// bytesDownloaded: 0,
// totalBytesToDownload: 0
// }

Decision matrix

How to branch on AppUpdateInfo to choose the right UX:

function chooseFlow(info: AppUpdateInfo, platform: 'ios' | 'android' | 'web') {
if (!info.updateAvailable) return 'none';
if (platform !== 'android') return 'open-store'; // iOS / web fallback
if (info.updatePriority >= 5 && info.immediateUpdateAllowed) return 'immediate';
if (info.updatePriority >= 3 && info.flexibleUpdateAllowed) return 'flexible-modal';
if (info.updatePriority >= 1 && info.flexibleUpdateAllowed) return 'flexible-banner';
return 'open-store';
}

OpenAppStoreOptions

Optional argument to openAppStore(). Used when you want to override the configured appStoreId / packageName — for example, opening a sister app's store page.

FieldTypeRequiredDescription
appIdstringnoiOS expects the numeric App Store ID (e.g. '1234567890'). Android expects the Java package name (e.g. 'com.yourcompany.yourapp').
const opts: OpenAppStoreOptions = { appId: '1234567890' };
await NativeUpdate.openAppStore(opts);

If both stores need different IDs (typical in production), configure them once in AppUpdateConfig.appStoreId + AppUpdateConfig.packageName in config and call openAppStore() with no arguments.


Type definitions verified against src/definitions.ts in the plugin repo as of 2026-05-10. Documented by Ahsan Mahmood.