Guides
Plan-enterprise-icon
Expo Application Services
API Reference

Constants

expo-constants provides system information that remains constant throughout the lifetime of your app's install.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb
Status-success-iconStatus-success-iconStatus-success-iconStatus-success-iconStatus-success-icon

Installation

Terminal
→ npx expo install expo-constants

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

API

import Constants from 'expo-constants';

Interfaces

AndroidManifest

AndroidManifest Properties

NameTypeDescription
versionCodenumber
Warning-icon
Deprecated. Use expo-application's Application.nativeBuildVersion.
The version code set by android.versionCode in app.json. The value is set to null in case you run your app in Expo Go.

IOSManifest

NameTypeDescription
buildNumbernull | stringThe build number specified in the embedded Info.plist value for CFBundleVersion in this app. In a standalone app, you can set this with the ios.buildNumber value in app.json. This may differ from the value in Constants.manifest.ios.buildNumber because the manifest can be updated, whereas this value will never change for a given native binary. The value is set to null in case you run your app in Expo Go.
modelnull | string
Warning-icon
Deprecated. Moved to expo-device as Device.modelName.
The human-readable model name of this device, e.g. "iPhone 7 Plus" if it can be determined, otherwise will be null.
platformstring
Warning-icon
Deprecated. Use expo-device's Device.modelId.
The Apple internal model identifier for this device, e.g. iPhone1,1.
systemVersionstring
Warning-icon
Deprecated. Use expo-device's Device.osVersion.
The version of iOS running on this device, e.g. 10.3.
userInterfaceIdiomUserInterfaceIdiom
Warning-icon
Deprecated. Use expo-device's Device.getDeviceTypeAsync().
The user interface idiom of this device, i.e. whether the app is running on an iPhone or an iPad.

ManifestAsset

NameTypeDescription
urlstring-

NativeConstants

getWebViewUserAgentAsync()

Gets the user agent string which would be included in requests sent by a web view running on this device. This is probably not the same user agent you might be providing in your JS fetch requests.

  • Undo-iconPromise<null | string>
NameTypeDescription
appOwnershipnull | AppOwnershipReturns expo, standalone, or guest. This property only applies to the managed workflow and classic builds; for apps built with EAS Build and in bare workflow, the result is always null.
debugModeboolean-
deviceName
(optional)
stringA human-readable name for the device type.
deviceYearClassnull | number
Warning-icon
Deprecated. Moved to expo-device as Device.deviceYearClass.
The device year class of this device.
executionEnvironmentExecutionEnvironment-
experienceUrlstring-
expoConfignull | ExpoConfigThe standard Expo config object defined in app.config.js files. For both classic and new manifests.
expoRuntimeVersionnull | string-
expoVersionnull | stringThe version string of the Expo Go app currently running. Returns null in bare workflow and web.
installationIdstring
Warning-icon
Deprecated. Constants.installationId is deprecated in favor of generating your own ID and storing it.
An identifier that is unique to this particular device and whose lifetime is at least as long as the installation of the app.
intentUri
(optional)
string-
isDetached
(optional)
boolean-
isDeviceboolean
Warning-icon
Deprecated. Use expo-device's Device.isDevice.
true if the app is running on a device, false if running in a simulator or emulator.
isHeadlessboolean-
linkingUristring-
manifestnull | AppManifestClassic manifest for Expo apps using classic updates. Returns null in bare workflow and when manifest2 is non-null.
manifest2null | ManifestNew manifest for Expo apps using modern Expo Updates. Returns null in bare workflow and when manifest is non-null.
nativeAppVersionnull | string
Warning-icon
Deprecated. Use expo-application's Application.nativeApplicationVersion.
The Info.plist value for CFBundleShortVersionString on iOS and the version name set by version in app.json on Android at the time the native app was built.
nativeBuildVersionnull | string
Warning-icon
Deprecated. Use expo-application's Application.nativeBuildVersion.
The Info.plist value for CFBundleVersion on iOS (set with ios.buildNumber value in app.json in a standalone app) and the version code set by android.versionCode in app.json on Android at the time the native app was built.
platform
(optional)
PlatformManifest-
sessionIdstringA string that is unique to the current session of your app. It is different across apps and across multiple launches of the same app.
statusBarHeightnumberThe default status bar height for the device. Does not factor in changes when location tracking is in use or a phone call is active.
systemFontsstring[]A list of the system font names available on the current device.
systemVersion
(optional)
number-

PlatformManifest

NameTypeDescription
android
(optional)
AndroidManifest-
detach
(optional)
{ scheme: string }-
developer
(optional)
string-
hostUri
(optional)
string-
ios
(optional)
IOSManifest-
logUrl
(optional)
string-
scheme
(optional)
string-
web
(optional)
WebManifest-

Types

AppManifest

Represents an intersection of all possible Config types.

Acceptable values are: ExpoClientConfig, ExpoGoConfig, EASConfig, ClientScopingConfig, Record<string, any>.

ClientScopingConfig

NameTypeDescription
scopeKey
(optional)
stringAn opaque unique string for scoping client-side data to this project. This value will not change when a project is transferred between accounts or renamed.

EASConfig

NameTypeDescription
projectId
(optional)
stringThe ID for this project if it's using EAS. UUID. This value will not change when a project is transferred between accounts or renamed.

ExpoClientConfig

ExpoConfig extended by:

NameTypeDescription
bundleUrlstring-
currentFullName
(optional)
stringThe Expo account name and slug used for display purposes. Formatted like @username/slug. When unauthenticated, the username is @anonymous. For published projects, this value may change when a project is transferred between accounts or renamed.
hostUri
(optional)
string-
id
(optional)
string
Warning-icon
Deprecated. Prefer projectId or originalFullName instead for identification and scopeKey for scoping due to immutability.
The Expo account name and slug for this project.
originalFullName
(optional)
stringThe original Expo account name and slug for this project. Formatted like @username/slug. When unauthenticated, the username is @anonymous. For published projects, this value will not change when a project is transferred between accounts or renamed.
publishedTime
(optional)
string-
releaseChannel
(optional)
string-
releaseId
(optional)
stringPublished apps only.
revisionId
(optional)
string-

ExpoGoConfig

NameTypeDescription
debuggerHost
(optional)
string-
developer
(optional)
{ tool: string }-
logUrl
(optional)
string-
mainModuleName
(optional)
string-
packagerOpts
(optional)
ExpoGoPackagerOpts-

ExpoGoPackagerOpts

NameTypeDescription
dev
(optional)
boolean-
hostType
(optional)
string-
lanType
(optional)
string-
minify
(optional)
boolean-
strict
(optional)
boolean-
urlRandomness
(optional)
string-
urlType
(optional)
string-
key
(index signature)
string-

Manifest

A modern manifest.

NameTypeDescription
assetsManifestAsset[]-
createdAtstring-
extra
(optional)
ManifestExtra-
idstring-
launchAssetManifestAsset-
metadataobject-
runtimeVersionstring-

ManifestExtra

ClientScopingConfig extended by:

NameTypeDescription
eas
(optional)
EASConfig-
expoClient
(optional)
ExpoConfig & { hostUri: string }-
expoGo
(optional)
ExpoGoConfig-

Enums

AppOwnership

AppOwnership.Expo = "expo"

The experience is running inside of the Expo Go app.

AppOwnership.Guest = "guest"

It has been opened through a link from a standalone app.

AppOwnership.Standalone = "standalone"

It is a standalone app.

ExecutionEnvironment

ExecutionEnvironment.Bare = "bare"
ExecutionEnvironment.Standalone = "standalone"
ExecutionEnvironment.StoreClient = "storeClient"

UserInterfaceIdiom

Current supported values are handset and tablet. Apple TV and CarPlay will show up as unsupported.

UserInterfaceIdiom.Handset = "handset"
UserInterfaceIdiom.Tablet = "tablet"
UserInterfaceIdiom.Unsupported = "unsupported"
  • Message-iconAsk a question on the forums about Constants
  • Github-iconView open bug reports for Constants
  • Code-iconView source code for Constants
  • Build-iconView package in npm Registry
  • Edit-iconEdit this page

Was this doc helpful?