expo-device
@amazon-devices/expo-device
provides access to system information about the physical device, such as its manufacturer and model.
Installation
- Add the JavaScript library dependency in the package.json file.
dependencies: { ... "@amazon-devices/expo-device": "~2.0.0", }
- Reinstall dependencies using
npm install
command. - Run the
kepler build
command.
Examples
import React, {useEffect, useState} from 'react';
import {StyleSheet, View, Text} from 'react-native';
import * as Device from '@amazon-devices/expo-device';
export const App = () => {
const [deviceType, setDeviceType] = useState<Device.DeviceType>();
const [uptime, setUptime] = useState<number>();
useEffect(() => {
Device.getDeviceTypeAsync().then(setDeviceType);
Device.getUptimeAsync().then(setUptime);
}, []);
return (
<View style={styles.container}>
<Text style={styles.text}>manufacturer: {Device.manufacturer}</Text>
<Text style={styles.text}>modelName: {Device.modelName}</Text>
<Text style={styles.text}>
is TV: {String(deviceType === Device.DeviceType.TV)}
</Text>
<Text style={styles.text}>uptime: {uptime}</Text>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
justifyContent: 'center',
alignItems: 'center',
},
text: {
fontSize: 30,
color: 'black',
},
});
API reference
Check out the dedicated documentation page for info about this library, API reference and more: Official Expo documentation for expo-device.
Constants
Name | Type | Description |
---|---|---|
Device.brand |
string | null |
The device brand. The consumer-visible brand of the product/hardware. On web and Vega, this value is always null |
Device.designName |
string | null |
The specific configuration or name of the industrial design. It represents the device's name when it was designed during manufacturing into mass production. On web and Vega, this value is always null |
Device.deviceName |
string | null |
The human-readable name of the device, which may be set by the device's user. If the device name is unavailable, particularly on web or Vega, this value is null |
Device.deviceType |
DeviceType | null |
The type of the device as a DeviceType enum value |
Device.deviceYearClass |
number | null |
The device year class of this device. On web and Vega, this value is always null |
Device.manufacturer |
string | null |
The actual device manufacturer of the product or hardware. This value of this field may be null if it cannot be determined |
Device.modelName |
string | null |
The human-friendly name of the device model. This is the name that people would typically use to refer to the device rather than a programmatic model identifier. This value of this field may be null if it cannot be determined |
Device.osBuildFingerprint |
string | null |
A string that uniquely identifies the build of the currently running system OS. |
Device.osBuildId |
string | null |
The build ID of the OS that more precisely identifies the version of the OS. On web, this value is always null |
Device.osInternalBuildId |
string | null |
The internal build ID of the OS running on the device. On web, this value is always null |
Device.osName |
string | null |
The name of the OS running on the device |
Device.osVersion |
string | null |
The human-readable OS version string. Note that the version string may not always contain three numbers separated by dots |
Device.productName |
string | null |
The device's overall product name chosen by the device implementer containing the development name or code name of the device. Corresponds to Build.PRODUCT. On web, this value is always null |
Device.supportedCpuArchitectures |
string[] | null |
A list of supported processor architecture versions. The device expects the binaries it runs to be compiled for one of these architectures. This value is null if the supported architectures could not be determined, particularly on web |
Device.totalMemory |
number | null |
The device's total memory, in bytes. This is the total memory accessible to the kernel, but not necessarily to a single app. This is basically the amount of RAM the device has, not including below-kernel fixed allocations like DMA buffers, RAM for the baseband CPU, etc… On web and Vega, this value is always null |
Methods
Name | Type | Description |
---|---|---|
Device.getDeviceTypeAsync() |
Promise<DeviceType> |
Checks the type of the device as a DeviceType enum value |
Device.getUptimeAsync() |
Promise<number> |
Gets the uptime since the last reboot of the device, in milliseconds. |
Enums
DeviceType
Name | Value | Description |
---|---|---|
UNKNOWN |
DeviceType.UNKNOWN = 0 |
An unrecognized device type |
PHONE |
DeviceType.PHONE = 1 |
Mobile phone handsets, typically with a touch screen and held in one hand |
TABLET |
DeviceType.TABLET = 2 |
Tablet computers, typically with a touch screen that is larger than a usual phone |
DESKTOP |
DeviceType.DESKTOP = 3 |
Desktop or laptop computers, typically with a keyboard and mouse |
TV |
DeviceType.TV = 4 |
Device with TV-based interfaces |
Error codes
Code | Description |
---|---|
ERR_DEVICE_ROOT_DETECTION |
Error code thrown for isRootedExperimentalAsync . This may be thrown if there's no read access to certain system files |
Implementation details
Device.deviceType
&Device.getDeviceTypeAsync()
- return eitherUNKNOWN
orTV
Device.totalMemory
- returns null
Unsupported APIs on Vega:
Device.brand
Device.designName
Device.deviceName
Device.deviceYearClass
Device.isRootedExperimentalAsync()
Supported versions
Package Version | Based On | @amazon-devices/react-native-kepler version |
---|---|---|
2.0.x | 5.8.0 | 2.0.x |
Additional resources
For information on additional libraries, see Supported Third-Party Libraries and Services.
Last updated: Sep 30, 2025