expo-application is a universal module within the Expo SDK that provides runtime access to native application metadata, such as the app's ID, human-readable name, and build version. It operates seamlessly across iOS, Android, and web platforms, although some properties are platform-specific. Expo SDKs, which include expo-application, are typically released three times per year, aligning with React Native's release cadence, with the current stable version being 55.0.14. This module differentiates itself by offering a unified JavaScript API for retrieving essential app identification data without requiring direct native code interaction, simplifying tasks like displaying version numbers to users, facilitating debugging, or integrating with analytics platforms. It is a fundamental building block for any Expo project needing to programmatically query its own identity.
npm install expo-applicationVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use expo-application to retrieve and display core application information such as name, ID, and version, in a functional React Native component.
Always test `expo-application` in a development build or a standalone production build to see your app's actual metadata. For debugging purposes in Expo Go, you might use `Constants.manifest.version` or `Constants.expoConfig.version` for basic version info from `app.json`.
For projects using Expo SDK 48 or higher targeting Android 13+, ensure `android.permissions` in your `app.json` or `app.config.js` includes `'com.google.android.gms.permission.AD_ID'`. You may also need to update Google Play Services in your project.
Use `Platform.OS === 'android'` conditionals to gate access to Android-only properties and methods. Provide fallback logic or UI for other platforms.
Understand and use the appropriate property for your needs. `nativeApplicationVersion` is for display to users, `nativeBuildVersion` is for app store uploads and internal tracking.
Ensure `Application.installReferrer` is only accessed on Android, typically guarded by `Platform.OS === 'android'`. Review usage if upgrading from SDK versions prior to 46.
Ensure `import * as Application from 'expo-application';` is at the top of your file. Clear the Metro bundler cache with `npx expo start --clear` or `expo start -c`, and if in a bare workflow, ensure native modules are correctly autolinked or manually linked, and rebuild the native app.
After installing new Expo packages or upgrading your SDK, run `npx expo install --fix` to update dependencies, then `npx expo prebuild --clean` (if using bare workflow) to regenerate native projects, and rebuild your native app (e.g., `npx expo run:ios`, `npx expo run:android`). Clear Node.js and npm/Yarn caches as well.
Always wrap platform-specific method calls with `Platform.OS` checks. For example, `if (Platform.OS === 'android') { const time = await Application.getInstallationTimeAsync(); }`.To see your application's specific version, you must build a development build or a standalone binary (APK/IPA). Alternatively, for `app.json` defined versions, `Constants.expoConfig.version` can be used as a workaround for managed workflow within Expo Go.