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.

This guide walks you through adding an in-app update check to an existing React Native screen. By the end you will have a working component that calls checkForUpdate, reads the resolved string, and handles every documented error case — all in TypeScript.

How it works

checkForUpdate returns a Promise<string>. On Android it communicates with the Google Play In-App Updates API and resolves or rejects depending on what the API reports. Passing UpdateFlow.FLEXIBLE starts a background download; passing UpdateFlow.IMMEDIATE shows a full-screen update interstitial that the user must complete before continuing.
1

Install the package

If you have not already installed the library, add it now and rebuild your Android app:
npm install react-native-in-app-updates
npx react-native run-android
See the Installation guide for Yarn/pnpm instructions and native module verification.
2

Import checkForUpdate and UpdateFlow

Both exports come from the same entry point:
import { checkForUpdate, UpdateFlow } from 'react-native-in-app-updates';
UpdateFlow is a TypeScript enum with two members:
UpdateFlow.FLEXIBLE   // Background download, app stays usable
UpdateFlow.IMMEDIATE  // Full-screen interstitial, must update to proceed
3

Call checkForUpdate inside useEffect

Trigger the check when your component mounts. Wrap the call in async/await inside a named function so you can use try/catch:
import { useEffect } from 'react';
import { checkForUpdate, UpdateFlow } from 'react-native-in-app-updates';

useEffect(() => {
  checkOnMount();
}, []);

async function checkOnMount() {
  try {
    const result = await checkForUpdate(UpdateFlow.FLEXIBLE);
    console.log('Update check result:', result);
    // result is one of:
    //   'No update available'
    //   'Flexible update started'
  } catch (e: any) {
    console.warn('Update check failed:', e.message);
  }
}
4

Handle the resolved values and error codes

The promise resolves with one of the following strings, or rejects with a structured error:
OutcomeTypeValue
No newer version in Play StoreResolve"No update available"
Flexible download initiatedResolve"Flexible update started"
Immediate update completedResolve"Update flow finished"
User dismissed the immediate promptRejectcode UPDATE_CANCELLED
Activity context is unavailableRejectcode NO_ACTIVITY
Play Core check call failedRejectcode UPDATE_CHECK_FAILED
Operation not allowedRejectcode NOT_ALLOWED
Read e.code in your catch block to differentiate recoverable conditions (e.g. UPDATE_CANCELLED) from hard failures (e.g. NO_ACTIVITY).

Complete TypeScript component

The example below mirrors the pattern used in the library’s own example app. It tracks status text and a loading flag, and exposes buttons for both real Play Store checks and offline mock tests using FakeAppUpdateManager.
import { useState } from 'react';
import {
  Text,
  View,
  TouchableOpacity,
  StyleSheet,
  SafeAreaView,
  ActivityIndicator,
} from 'react-native';
import { checkForUpdate, UpdateFlow } from 'react-native-in-app-updates';

export default function App() {
  const [status, setStatus] = useState('Idle');
  const [loading, setLoading] = useState(false);

  async function handleCheckForUpdate(flow: UpdateFlow, isMock: boolean) {
    setLoading(true);
    setStatus(`Checking (${isMock ? 'Mock' : 'Real'} ${flow})...`);
    try {
      const result = await checkForUpdate(flow, isMock);
      setStatus(`Success: ${result}`);
    } catch (e: any) {
      setStatus(`Error: ${e.message || e}`);
    } finally {
      setLoading(false);
    }
  }

  return (
    <SafeAreaView style={styles.container}>
      {/* Status display */}
      <View style={styles.card}>
        {loading ? (
          <ActivityIndicator size="small" />
        ) : (
          <Text>{status}</Text>
        )}
      </View>

      {/* Real Play Store checks */}
      <TouchableOpacity
        onPress={() => handleCheckForUpdate(UpdateFlow.FLEXIBLE, false)}
      >
        <Text>Real Flexible</Text>
      </TouchableOpacity>
      <TouchableOpacity
        onPress={() => handleCheckForUpdate(UpdateFlow.IMMEDIATE, false)}
      >
        <Text>Real Immediate</Text>
      </TouchableOpacity>

      {/* Offline mock checks (FakeAppUpdateManager) */}
      <TouchableOpacity
        onPress={() => handleCheckForUpdate(UpdateFlow.FLEXIBLE, true)}
      >
        <Text>Mock Flexible</Text>
      </TouchableOpacity>
      <TouchableOpacity
        onPress={() => handleCheckForUpdate(UpdateFlow.IMMEDIATE, true)}
      >
        <Text>Mock Immediate</Text>
      </TouchableOpacity>
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: { flex: 1, justifyContent: 'center', padding: 20 },
  card: { marginBottom: 24, minHeight: 60, justifyContent: 'center' },
});
The second argument to checkForUpdate is the optional isMock flag. When true, the library uses Android’s FakeAppUpdateManager instead of the real Play Core client. This lets you test all update paths locally without a Play Store listing — no network connection or published app required.

Next steps

Now that you have a working update check, explore the two flow-specific guides for deeper coverage of completion callbacks, user prompting, and cancellation handling:

Flexible Update Guide

Handle background download completion, trigger the install prompt, and manage the update lifecycle.

Immediate Update Guide

Handle UPDATE_CANCELLED gracefully and decide whether to re-prompt or surface a manual update link.

Build docs developers (and LLMs) love