Skip to main content

Types

All types are exported from the package root:

import type {
BatteryState,
DeviceDetails,
DeviceType,
ListenerSubscription,
PowerState,
} from 'nitro-device-info'

DeviceDetails​

Device and app values that stay the same while the app runs, returned by getDeviceDetails(). Optional fields are absent on one platform; Platform differences lists the source of each.

FieldTypeDescription
brandstringThe consumer brand: Apple on iOS, Build.BRAND on Android, for example google.
manufacturerstringApple on iOS, Build.MANUFACTURER on Android, for example Google.
modelstringUIDevice.model on iOS (iPhone, iPad), Build.MODEL on Android (Pixel 9).
modelNamestringThe marketing name, for example iPhone 16 Pro. Falls back to model for iOS models the table does not know.
deviceIdstringThe hardware identifier: machine name on iOS (iPhone17,3), Build.DEVICE on Android (tokay).
productNamestring, optionalBuild.PRODUCT, for example tokay. Absent on iOS.
deviceNamestringThe name the user gave the device. The generic model on iOS 16+ without the entitlement.
deviceTypeDeviceTypeThe kind of device.
deviceYearClassnumber, optionalThe release year of a flagship with similar performance. Absent for iOS models the table does not know.
supportedAbisstring[]The CPU architectures the device runs, most preferred first, for example arm64-v8a.
systemNamestringiOS or iPadOS on iOS, Android on Android.
systemVersionstringThe OS version, for example 27.2 or 16.
osBuildIdstringThe kernel's OS version on iOS (24A335), Build.DISPLAY on Android.
osBuildFingerprintstring, optionalBuild.FINGERPRINT. Absent on iOS.
apiLevelnumber, optionalBuild.VERSION.SDK_INT. Absent on iOS.
appNamestringThe app's display name.
bundleIdstringThe bundle identifier on iOS, the application ID on Android.
appVersionstringCFBundleShortVersionString on iOS, versionName on Android.
buildNumberstringCFBundleVersion on iOS, versionCode on Android.
installerPackageNamestring, optionalThe store that installed the app, for example com.android.vending. Absent on iOS and when sideloaded.
isEmulatorbooleanWhether the app runs on the iOS simulator or an Android emulator. The Android check is a heuristic.
isRootedbooleanWhether the device looks jailbroken or rooted. A heuristic; always false on simulators and emulators.
hasNotchbooleanWhether the screen has a notch or another cutout. A Dynamic Island does not count. false before Android API 29.
hasDynamicIslandbooleanWhether the screen has a Dynamic Island. Always false on Android.
totalMemorynumberThe device's physical memory in bytes.
maxMemorynumber, optionalThe Java heap limit in bytes (Runtime.maxMemory). Absent on iOS.

PowerState​

The battery and power-saving state, returned by getPowerState() and passed to power state listeners.

FieldTypeDescription
batteryLevelnumber, optionalCharge from 0 to 1, or undefined when the platform cannot tell, as on the iOS simulator.
batteryStateBatteryStateWhether the battery is charging.
lowPowerModebooleanWhether Low Power Mode on iOS or Battery Saver on Android is on.

BatteryState​

type BatteryState = 'unknown' | 'unplugged' | 'charging' | 'full'
ValueMeaning
unknownThe platform cannot tell, as on the iOS simulator.
unpluggedRunning on battery.
chargingPlugged in and charging.
fullPlugged in with a full battery.

DeviceType​

type DeviceType = 'phone' | 'tablet' | 'tv' | 'desktop' | 'unknown'
ValueMeaning
phoneA phone.
tabletA tablet: an iPad, or an Android device at least 600 dp wide.
tvA TV.
desktopAn iPhone or iPad app running on a Mac, or an Android device in desktop mode.
unknownA device the platform does not classify, such as Apple Vision Pro.

ListenerSubscription​

interface ListenerSubscription {
remove: () => void
}

A registered listener, returned by addOnPowerStateChangedListener. Call remove() to stop receiving events; calling it again does nothing.