Use this file to discover all available pages before exploring further.
Testing real Play Store update flows requires your app to be published (at minimum to Internal App Sharing) with a lower version code already installed on the device. This makes iterative testing slow and impractical during development. The isMock parameter solves this by swapping in Google Play Core’s FakeAppUpdateManager, which simulates the entire update lifecycle locally — no network connection or Play Store account needed.
Internally, the native module replaces the real AppUpdateManager with a FakeAppUpdateManager instance and immediately sets its availability to UpdateAvailability.UPDATE_AVAILABLE. This means an update is always found in mock mode, regardless of what version is installed.The fake manager then auto-progresses through the entire update lifecycle without any real downloads or Play Store calls:
The native Kotlin code that drives this is shown below for reference:
// From InAppUpdatesModule.kt — FLEXIBLE pathif (isMock && manager is FakeAppUpdateManager) { if (manager.isConfirmationDialogVisible) { manager.userAcceptsUpdate() manager.downloadStarts() manager.downloadCompletes() }}// From InAppUpdatesModule.kt — IMMEDIATE pathif (isMock && manager is FakeAppUpdateManager) { if (manager.isImmediateFlowVisible) { manager.userAcceptsUpdate() manager.downloadStarts() manager.downloadCompletes() manager.installCompletes() }}
Mock mode must never be enabled in a production build. Use an environment variable or a build-time flag to ensure isMock is always false in release builds. See the Environment flag pattern section below.
The Promise resolves with "Flexible update started" once the fake flow begins. The FakeAppUpdateManager cycles through all install states synchronously, so the entire simulated download-and-install happens immediately.
import { checkForUpdate, UpdateFlow } from 'react-native-in-app-updates';async function testImmediateMock() { try { const result = await checkForUpdate(UpdateFlow.IMMEDIATE, true); // Simulates: userAcceptsUpdate → downloadStarts → downloadCompletes → installCompletes // onActivityResult is called with RESULT_OK by the fake manager console.log('Mock immediate result:', result); // result === 'Update flow finished' } catch (e: any) { console.error('Mock immediate error:', e.code, e.message); }}
The Promise resolves with "Update flow finished" once installCompletes() fires on the fake manager, which triggers onActivityResult with RESULT_OK — identical to a real update finishing.
The example below mirrors the pattern used in the library’s own example app (example/src/App.tsx) and shows how to expose both real and mock flows side-by-side during development:
import { useState } from 'react';import { Button, Text, View } from 'react-native';import { checkForUpdate, UpdateFlow } from 'react-native-in-app-updates';const IS_MOCK = __DEV__; // Only mock in development buildsexport function UpdateTester() { const [status, setStatus] = useState('Idle'); async function run(flow: UpdateFlow, mock: boolean) { setStatus(`Running ${mock ? 'mock' : 'real'} ${flow}...`); try { const result = await checkForUpdate(flow, mock); setStatus(`✅ ${result}`); } catch (e: any) { setStatus(`❌ [${e.code}] ${e.message}`); } } return ( <View> <Text>{status}</Text> {/* Real flows — require a published Play Store version */} <Button title="Real Flexible" onPress={() => run(UpdateFlow.FLEXIBLE, false)} /> <Button title="Real Immediate" onPress={() => run(UpdateFlow.IMMEDIATE, false)} /> {/* Mock flows — work entirely offline in development */} {IS_MOCK && ( <> <Button title="Mock Flexible" onPress={() => run(UpdateFlow.FLEXIBLE, true)} /> <Button title="Mock Immediate" onPress={() => run(UpdateFlow.IMMEDIATE, true)} /> </> )} </View> );}
Never ship isMock: true to end users. The safest approach is to tie the flag to a build-time or environment constant:
// __DEV__ is true in Metro dev builds, false in production bundlesconst result = await checkForUpdate(UpdateFlow.FLEXIBLE, __DEV__);
Because FakeAppUpdateManager always reports an update as available, mock mode is also useful for verifying your UI handles the "No update available" resolved path — simply pass isMock: false against a development build where the installed version matches the Play Store version.