Skip to main content

Documentation 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 returns a Promise that either resolves with a success string or rejects with an Error object. Errors originate from two layers: the TypeScript module (platform and argument validation) and the Kotlin native module (Play Core API responses). This guide documents every possible rejection and the best way to handle it.

Success values are not errors

Before diving into errors, note that "No update available" is a resolved value — it means checkForUpdate succeeded and the Play Store confirmed the app is already current. Never treat it as an error condition.
const result = await checkForUpdate(UpdateFlow.FLEXIBLE);

if (result === 'No update available') {
  // This is a happy path — the app is up to date
}
Always wrap checkForUpdate in a try/catch and inspect error.code for programmatic branching. The code property maps to the string codes listed in this guide.
import { checkForUpdate, UpdateFlow } from 'react-native-in-app-updates';

async function safeUpdateCheck(flow: UpdateFlow) {
  try {
    const result = await checkForUpdate(flow);
    console.log('Update result:', result);
  } catch (error: any) {
    // error.code   — machine-readable identifier (use for switch/if logic)
    // error.message — human-readable description
    switch (error.code) {
      case 'UPDATE_CANCELLED':
        // User dismissed an immediate update — retry on next foreground
        scheduleRetry();
        break;

      case 'NOT_ALLOWED':
        // This update type is unavailable — try the other flow
        if (flow === UpdateFlow.FLEXIBLE) {
          safeUpdateCheck(UpdateFlow.IMMEDIATE);
        }
        break;

      case 'UPDATE_CHECK_FAILED':
        // Network or Play Store error — log and silently continue
        logError('update_check_failed', error.message);
        break;

      case 'NO_ACTIVITY':
        // Android Activity is not available — try again after navigation settles
        console.warn('No activity — will retry.');
        break;

      default:
        // Covers platform errors, invalid arguments, or unexpected rejections
        console.error(`[${error.code ?? 'ERROR'}] ${error.message}`);
    }
  }
}

Error reference

Origin: TypeScript layer (src/index.tsx)When it occurs: checkForUpdate was called on iOS, web, or any non-Android platform. The rejection happens synchronously before the native module is ever touched.error.code: undefined (standard Error, no .code property set)Recommended action: Guard all checkForUpdate calls with a platform check:
import { Platform } from 'react-native';
import { checkForUpdate, UpdateFlow } from 'react-native-in-app-updates';

if (Platform.OS === 'android') {
  await checkForUpdate(UpdateFlow.FLEXIBLE);
}
This library is Android-only by design — Google Play In-App Updates is not available on iOS.
Origin: TypeScript layer (src/index.tsx)When it occurs: A string or value other than UpdateFlow.IMMEDIATE or UpdateFlow.FLEXIBLE was passed as the first argument.error.code: undefined (standard Error, no .code property set)Recommended action: Always use the exported UpdateFlow enum rather than raw strings:
// ✅ Correct — use the enum
checkForUpdate(UpdateFlow.FLEXIBLE);

// ❌ Wrong — raw string bypasses TypeScript type safety at runtime
checkForUpdate('flexible' as any);
TypeScript’s type system will catch this at compile time if UpdateFlow is used correctly.
Origin: Kotlin native module (InAppUpdatesModule.kt)error.code: "NO_ACTIVITY"When it occurs: The native module attempted to start the update flow but reactApplicationContext.currentActivity returned null. This typically happens when:
  • checkForUpdate is called before the root Activity has fully mounted.
  • The app is in the background or in the middle of an Activity transition.
  • The device is in a split-screen or PiP mode edge case.
Recommended action: Delay the update check until after the app is fully foregrounded and mounted. Using AppState to trigger the check on 'active' is the most reliable approach:
import { AppState } from 'react-native';

AppState.addEventListener('change', (state) => {
  if (state === 'active') {
    checkForUpdate(UpdateFlow.FLEXIBLE).catch(console.error);
  }
});
Origin: Kotlin native module — onActivityResult callbackerror.code: "UPDATE_CANCELLED"When it occurs: Only relevant for UpdateFlow.IMMEDIATE. The onActivityResult callback fired with a result code other than RESULT_OK, meaning the user dismissed the full-screen update dialog. This is rare — on most devices the immediate update overlay cannot be dismissed — but it is device-dependent and must be handled.Recommended action: Re-trigger the update check the next time the app comes to the foreground. Do not silently swallow this error for critical updates.
try {
  await checkForUpdate(UpdateFlow.IMMEDIATE);
} catch (e: any) {
  if (e.code === 'UPDATE_CANCELLED') {
    // For critical updates: re-check on next foreground
    // For non-critical: consider downgrading to FLEXIBLE
    console.warn('Immediate update cancelled by user.');
  }
}
This rejection is never thrown by UpdateFlow.FLEXIBLE — flexible update acceptance is handled by the install-state listener, not onActivityResult.
Origin: Kotlin native module — startFlexibleUpdate / startImmediateUpdateerror.code: "NOT_ALLOWED"When it occurs: appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE) or isUpdateTypeAllowed(AppUpdateType.IMMEDIATE) returned false. The Play Store server can restrict which update type is permitted for a given update. For example, Google Play can force an immediate update server-side for a release marked as high-priority, making FLEXIBLE unavailable.Recommended action: Fall back to the other update flow type:
async function checkWithFallback() {
  try {
    await checkForUpdate(UpdateFlow.FLEXIBLE);
  } catch (e: any) {
    if (e.code === 'NOT_ALLOWED') {
      // Flexible not permitted — attempt immediate instead
      await checkForUpdate(UpdateFlow.IMMEDIATE);
    } else {
      throw e;
    }
  }
}
Origin: Kotlin native module — addOnFailureListener on the appUpdateInfo taskerror.code: "UPDATE_CHECK_FAILED"When it occurs: The Play Core API call to fetch appUpdateInfo failed. Common causes include:
  • No internet connection at the time of the check.
  • Google Play Store app not installed or not signed in.
  • Play Core library version mismatch.
  • Play Store servers returned an error.
error.message: Contains e.localizedMessage from the underlying Play Core exception — useful for logging.Recommended action: Treat this as a soft failure. Do not block the user — simply log the error and retry later:
try {
  await checkForUpdate(UpdateFlow.FLEXIBLE);
} catch (e: any) {
  if (e.code === 'UPDATE_CHECK_FAILED') {
    // Non-blocking: log and continue, retry on next app launch
    analytics.logEvent('update_check_failed', { detail: e.message });
  }
}

Quick reference table

error.codeOriginFlowSuggested action
(none)TypeScriptBothUse UpdateFlow enum; add Platform.OS === 'android' guard
(none)TypeScriptBothPass valid UpdateFlow enum value
NO_ACTIVITYKotlinBothRetry after app is foregrounded and Activity is available
UPDATE_CANCELLEDKotlinImmediate onlyRetry on next foreground via AppState listener
NOT_ALLOWEDKotlinBothFall back to the other UpdateFlow type
UPDATE_CHECK_FAILEDKotlinBothLog silently; retry on next launch or when network is available

Build docs developers (and LLMs) love