expo-device

Device Information with expo-device

expo-device (npx expo install expo-device, 57.0.2 for SDK 57) reads hardware facts that React Native 36,878 's Platform leaves out: brand, manufacturer, modelName, osName, osVersion, platformApiLevel, totalMemory, supportedCpuArchitectures, deviceYearClass, isDevice (false on emulators and simulators), and deviceType, one of the DeviceType enum's UNKNOWN, PHONE, TABLET, DESKTOP and TV. Most are constants; a few, such as getDeviceTypeAsync() and getUptimeAsync(), are promises.

src/info/DeviceFacts.tsx: what the emulator says about itself (excerpt)TSX
    const gb = (Device.totalMemory ?? 0) / 1024 ** 3;
    console.log(`${Device.brand} ${Device.modelName}, ${Device.osName} ${Device.osVersion} `
      + `(API ${Device.platformApiLevel}), real device: ${Device.isDevice}`);
    console.log(`type ${Device.DeviceType[Device.deviceType ?? 0]}, `
      + `year class ${Device.deviceYearClass}, memory ${gb.toFixed(1)} GB`);
Output
 LOG  google sdk_gphone64_x86_64, Android 16 (API 36), real device: false
 LOG  type PHONE, year class 2014, memory 2.9 GB

The 3 GB emulator was classified by memory as a 2014-class phone, a reminder that deviceYearClass is a rough estimate. Use isDevice to skip features an emulator lacks, such as push tokens (Push Notifications), and deviceYearClass or totalMemory to choose lighter animations or smaller images on low-end phones. On iOS 16 and later, deviceName reads "iPhone" unless the app has the matching entitlement (from the documentation; not run here).