Skip to main content

expo-device

Version: 55.0.7 A universal module that gets physical information about the device running the application.

Installation

npx expo install expo-device

Usage

import * as Device from 'expo-device';

console.log(Device.modelName); // "iPhone 14 Pro"
console.log(Device.osVersion); // "16.0"
console.log(Device.deviceType); // Device.DeviceType.PHONE

API Reference

Properties

Device.brand
string | null
Device brand (e.g., “Apple”, “Samsung”)
Device.manufacturer
string | null
Device manufacturer
Device.modelName
string | null
Device model name (e.g., “iPhone 14 Pro”, “Pixel 7”)
Device.modelId
string | null
Internal model identifier
Device.designName
string | null
Device design name
Device.productName
string | null
Product name
Device.deviceYearClass
number | null
Approximate year the device was released
Device.totalMemory
number
Total device memory in bytes
Device.supportedCpuArchitectures
string[] | null
Supported CPU architectures (e.g., [“arm64”, “armv7”])
Device.osName
string
OS name (“iOS”, “Android”, etc.)
Device.osVersion
string
OS version string
Device.osBuildId
string | null
OS build ID
Device.osInternalBuildId
string | null
Internal OS build identifier
Device.platformApiLevel
number | null
Android only: Android API level
Device.deviceName
string | null
User-assigned device name (e.g., “John’s iPhone”)
Device.deviceType
DeviceType
Type of device:
  • Device.DeviceType.PHONE
  • Device.DeviceType.TABLET
  • Device.DeviceType.DESKTOP
  • Device.DeviceType.TV
  • Device.DeviceType.UNKNOWN

Methods

Device.getDeviceTypeAsync()
() => Promise<DeviceType>
Asynchronously gets device type
const deviceType = await Device.getDeviceTypeAsync();
Device.isRootedExperimentalAsync()
() => Promise<boolean>
Experimental: Checks if device is rooted/jailbroken
const isRooted = await Device.isRootedExperimentalAsync();
Device.isSideLoadingEnabledAsync()
() => Promise<boolean>
Android only: Checks if side-loading is enabled
Device.getPlatformFeaturesAsync()
() => Promise<string[]>
Android only: Gets list of supported platform features
Device.hasPlatformFeatureAsync(feature)
(feature: string) => Promise<boolean>
Android only: Checks if device supports a specific feature
const hasNFC = await Device.hasPlatformFeatureAsync(
  'android.hardware.nfc'
);
Device.getMaxMemoryAsync()
() => Promise<number>
Gets maximum available memory in bytes

Examples

Display Device Info

import * as Device from 'expo-device';
import { Text, View } from 'react-native';

function DeviceInfo() {
  return (
    <View>
      <Text>Brand: {Device.brand}</Text>
      <Text>Model: {Device.modelName}</Text>
      <Text>OS: {Device.osName} {Device.osVersion}</Text>
      <Text>Device Type: {
        Device.deviceType === Device.DeviceType.PHONE ? 'Phone' :
        Device.deviceType === Device.DeviceType.TABLET ? 'Tablet' :
        'Unknown'
      }</Text>
      <Text>Memory: {(Device.totalMemory / 1024 / 1024 / 1024).toFixed(2)} GB</Text>
    </View>
  );
}

Check Device Capabilities

import * as Device from 'expo-device';
import { Platform } from 'react-native';

async function checkCapabilities() {
  const deviceType = await Device.getDeviceTypeAsync();
  const isTablet = deviceType === Device.DeviceType.TABLET;
  
  if (Platform.OS === 'android') {
    const hasNFC = await Device.hasPlatformFeatureAsync(
      'android.hardware.nfc'
    );
    console.log('NFC Support:', hasNFC);
  }
  
  const maxMemory = await Device.getMaxMemoryAsync();
  console.log('Max Memory:', maxMemory);
}

Responsive Layout Based on Device

import * as Device from 'expo-device';
import { View, StyleSheet } from 'react-native';

function ResponsiveLayout({ children }) {
  const isTablet = Device.deviceType === Device.DeviceType.TABLET;
  
  return (
    <View style={[
      styles.container,
      isTablet && styles.tabletContainer
    ]}>
      {children}
    </View>
  );
}

const styles = StyleSheet.create({
  container: { padding: 16 },
  tabletContainer: { padding: 32, maxWidth: 1024 }
});

Platform Support

PlatformSupported
iOS
Android
Web

Resources