React Native · APIs and utilities
Device
Device and app info.
5 exports
Import
Device
moduleDevice and app info. Fields are read from the native module on first access.
| Name | Type | Description |
|---|---|---|
brand | string | Brand (Apple, samsung, google…). |
manufacturer | string | Manufacturer. |
model | string | Model name (Android: Pixel 8; iOS: iPhone/iPad). |
modelId | string | Hardware id (iOS: iPhone16,1; Android: the device code name). |
osName | DeviceConstants["osName"] | iOS, iPadOS or Android. |
osVersion | string | Operating system version (18.2, 15). |
apiLevel | number | null | Android API level; null on iOS. |
isEmulator | boolean | Whether it is a simulator/emulator. |
deviceType | DeviceType | Device type. |
totalMemory | number | Total memory (bytes). |
deviceName | string | Device name set by the user. iOS 16+ returns the generic name (iPhone) without a special entitlement. |
applicationId | string | Bundle id (com.company.app). |
appName | string | Display name of the app. |
appVersion | string | Version (1.2.0). |
buildNumber | string | Build number (42). |
installTime | number | null | First install time (ms, epoch); null if unknown. |
getUniqueId | () => Promise<string> | Id specific to the device and the app (iOS identifierForVendor, Android ANDROID_ID). May change when the app is reinstalled (iOS) or the device is reset; it is not an advertising id. |
getBattery | () => Promise<BatteryState> | Battery state. |
getStorage | () => Promise<StorageInfo> | Storage space. |
getUptime | () => Promise<number> | Time the device has been up (ms). |
addBatteryListener | (listener: (state: BatteryState) => void) => () => void | Called when the battery changes. Returns a function that ends the subscription. |
useBattery
functionWatches the battery state (null until the first value arrives).
DeviceType
typeDevice type. desktop: an iPhone/iPad app on a Mac, or ChromeOS.
BatteryState
interfaceBattery state.
| Name | Type | Description |
|---|---|---|
level | number | null | Charge level (0–1); null if unknown (iOS simulator). |
state | "charging" | "full" | "unplugged" | "unknown" | charging, full, unplugged or unknown. |
lowPowerMode | boolean | Whether low power / battery saver mode is on. |
StorageInfo
interfaceStorage (bytes).
| Name | Type | Description |
|---|---|---|
free | number | Available space. |
total | number | Total space. |