TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/aravind3566/react-native-in-app-updates/llms.txt
Use this file to discover all available pages before exploring further.
checkForUpdate function is the single entry point for the react-native-in-app-updates library. Call it at app startup (or at any meaningful moment in your UX) to query the Play Store and, when an update is available, immediately launch the chosen update flow. The function returns a Promise that resolves with a plain string describing the outcome, or rejects with a descriptive error.
This function only works on Android. Calling it on iOS or any other platform will immediately reject with
'This library is only available on Android.' — no native code is invoked.Signature
Parameters
Determines which Play Store update flow to launch when an update is available.
Must be one of the two members of the
UpdateFlow enum:UpdateFlow.FLEXIBLE— Starts a background download; the user can continue using the app while the update downloads.UpdateFlow.IMMEDIATE— Launches a full-screen blocking UI; the user must complete (or cancel) the update before returning to the app.
When set to
true, the native module swaps the real AppUpdateManager for Google Play’s FakeAppUpdateManager. This allows you to test the entire update flow — including download, install, and completion events — without a live Play Store connection or a published update. The fake manager automatically marks an update as available and drives the mock flow to completion.Set this to false (or omit it) in production builds.Return value
The function returnsPromise<string>. On success, the promise resolves to one of the following string values:
The Play Store reports that the installed version is already the latest. No update flow is launched; you can silently ignore this result or show an “up to date” message to the user.
The flexible update flow was successfully launched. The promise resolves immediately after the flow starts — the download continues in the background while the user keeps using the app. Listen for
InstallStatus.DOWNLOADED events if you want to prompt the user to apply the update.The immediate update completed successfully (
Activity.RESULT_OK). Because immediate updates restart the app as part of the install, you will typically only see this value during mock testing. In production, the app will have already restarted.Errors
All errors are thrown as standard JavaScriptError objects (or native bridge rejections) and can be caught in the .catch() handler or a try/catch block.
Platform not supported — 'This library is only available on Android.'
Platform not supported — 'This library is only available on Android.'
Source: JavaScript layer, before any native call.Thrown when
Platform.OS is not 'android'. The library has no iOS or web implementation; any non-Android platform will trigger this rejection immediately.Invalid flow — 'Invalid update flow. Use UpdateFlow.IMMEDIATE or UpdateFlow.FLEXIBLE.'
Invalid flow — 'Invalid update flow. Use UpdateFlow.IMMEDIATE or UpdateFlow.FLEXIBLE.'
Source: JavaScript layer, before any native call.Thrown when the
updateFlow argument is not a member of the UpdateFlow enum. This is a development-time guard — use the enum constants rather than raw strings to avoid this error.NO_ACTIVITY — No current Android Activity found
NO_ACTIVITY — No current Android Activity found
Source: Native Kotlin module (
InAppUpdatesModule.kt).Thrown when reactApplicationContext.currentActivity is null at the time of the call. This can happen if you call checkForUpdate too early in the app lifecycle, before the first Activity has been created, or after the app has been backgrounded and the activity reference has been cleared.Mitigation: Delay the call until after AppState is 'active' and the root component has fully mounted.UPDATE_CHECK_FAILED — Play Store update info check failed
UPDATE_CHECK_FAILED — Play Store update info check failed
Source: Native Kotlin module (
InAppUpdatesModule.kt).Thrown when the appUpdateInfo task returned by AppUpdateManager fires its OnFailureListener. Common causes include no internet connectivity, the device not being signed in to a Google account, or the app not being distributed through the Play Store.The rejection message will contain the underlying exception’s localizedMessage for diagnostics.NOT_ALLOWED — The requested update type is not allowed for this update
NOT_ALLOWED — The requested update type is not allowed for this update
Source: Native Kotlin module (
InAppUpdatesModule.kt).Thrown when the Play Store confirms an update is available but AppUpdateInfo.isUpdateTypeAllowed() returns false for the requested type. Google Play determines eligibility based on criteria such as update staleness, update priority, and app metadata. Consider falling back to the other update flow type when this error occurs.UPDATE_CANCELLED — User cancelled the Immediate update flow
UPDATE_CANCELLED — User cancelled the Immediate update flow
Source: Native Kotlin module (
InAppUpdatesModule.kt), via onActivityResult.Thrown when the immediate update UI returns Activity.RESULT_CANCELED — the user tapped the back button or dismissed the update screen. This rejection is only possible with UpdateFlow.IMMEDIATE; the flexible flow resolves immediately after launch and does not wait for user interaction.Decide whether to re-prompt the user, disable features, or simply record the cancellation for analytics.Usage example
Testing with the mock manager
UseisMock: true to exercise both update flows in a local development build without needing a published update on the Play Store:
Linking error
If you see a runtime error such as:npx react-native run-android) after adding the package, and that you are not running inside the Expo Go sandbox, which does not support custom native modules.