Get device information using react-native
—
Core device identification functionality for retrieving unique identifiers, device details, and hardware information. Essential for analytics, device tracking, and platform-specific behavior.
Get unique device identifiers for tracking and analytics purposes.
/**
* Get unique device identifier (async)
* @returns Promise resolving to unique device ID string
* @platforms Android, iOS, Windows
*/
function getUniqueId(): Promise<string>;
/**
* Get unique device identifier (sync)
* @returns Unique device ID string
* @platforms Android, iOS, Windows
*/
function getUniqueIdSync(): string;
/**
* iOS-specific method to sync unique ID
* @returns Promise resolving to unique ID
* @platforms iOS
*/
function syncUniqueId(): Promise<string>;
/**
* Get device identifier
* @returns Device identifier string
* @platforms Android, iOS, Windows
*/
function getDeviceId(): string;Usage Examples:
import { getUniqueId, getUniqueIdSync, getDeviceId } from 'react-native-device-info';
// Async approach
const uniqueId = await getUniqueId();
console.log('Unique ID:', uniqueId);
// Sync approach (faster for app startup)
const uniqueIdSync = getUniqueIdSync();
console.log('Unique ID (sync):', uniqueIdSync);
// Device ID (always sync)
const deviceId = getDeviceId();
console.log('Device ID:', deviceId);Android-specific device identifiers.
/**
* Get Android ID (async)
* @returns Promise resolving to Android ID
* @platforms Android
*/
function getAndroidId(): Promise<string>;
/**
* Get Android ID (sync)
* @returns Android ID string
* @platforms Android
*/
function getAndroidIdSync(): string;
/**
* Get instance ID (async)
* @returns Promise resolving to instance ID
* @platforms Android
*/
function getInstanceId(): Promise<string>;
/**
* Get instance ID (sync)
* @returns Instance ID string
* @platforms Android
*/
function getInstanceIdSync(): string;
/**
* Get device serial number (async)
* @returns Promise resolving to serial number
* @platforms Android, Windows
*/
function getSerialNumber(): Promise<string>;
/**
* Get device serial number (sync)
* @returns Serial number string
* @platforms Android, Windows
*/
function getSerialNumberSync(): string;Basic device information including model, brand, and manufacturer.
/**
* Get device model
* @returns Device model string
* @platforms iOS, Android, Windows
*/
function getModel(): string;
/**
* Get device brand
* @returns Device brand string
* @platforms Android, iOS, Windows
*/
function getBrand(): string;
/**
* Get device manufacturer (async)
* @returns Promise resolving to manufacturer name
* @platforms Android, iOS, Windows
*/
function getManufacturer(): Promise<string>;
/**
* Get device manufacturer (sync)
* @returns Manufacturer name string
* @platforms Android, iOS, Windows
*/
function getManufacturerSync(): string;
/**
* Get device name (async)
* @returns Promise resolving to device name
* @platforms Android, iOS, Windows
*/
function getDeviceName(): Promise<string>;
/**
* Get device name (sync)
* @returns Device name string
* @platforms Android, iOS, Windows
*/
function getDeviceNameSync(): string;Usage Examples:
import {
getModel,
getBrand,
getManufacturer,
getDeviceName
} from 'react-native-device-info';
// Get basic device info
const model = getModel();
const brand = getBrand();
const manufacturer = await getManufacturer();
const deviceName = await getDeviceName();
console.log(`Device: ${brand} ${model}`);
console.log(`Manufacturer: ${manufacturer}`);
console.log(`Device Name: ${deviceName}`);Determine device type and basic capabilities.
/**
* Get device type
* @returns Device type string
* @platforms Android, iOS, Windows
*/
function getDeviceType(): string;
/**
* Get device type (sync version)
* @returns Device type string
* @platforms Android, iOS, Windows
*/
function getDeviceTypeSync(): string;
/**
* Check if device is a tablet
* @returns True if device is a tablet
* @platforms Android, iOS, Windows
*/
function isTablet(): boolean;
/**
* Check if running on emulator (async)
* @returns Promise resolving to true if emulator
* @platforms Android, iOS, Windows
*/
function isEmulator(): Promise<boolean>;
/**
* Check if running on emulator (sync)
* @returns True if running on emulator
* @platforms Android, iOS, Windows
*/
function isEmulatorSync(): boolean;
/**
* Check if device is low RAM device
* @returns True if device has low RAM
* @platforms Android
*/
function isLowRamDevice(): boolean;
/**
* Check if display is zoomed
* @returns True if display is zoomed
* @platforms iOS
*/
function isDisplayZoomed(): boolean;Usage Examples:
import {
getDeviceType,
isTablet,
isEmulator,
isLowRamDevice
} from 'react-native-device-info';
// Device type detection
const deviceType = getDeviceType();
const isTabletDevice = isTablet();
const isEmulatorDevice = await isEmulator();
console.log(`Device Type: ${deviceType}`);
console.log(`Is Tablet: ${isTabletDevice}`);
console.log(`Is Emulator: ${isEmulatorDevice}`);
// Platform-specific checks
if (Platform.OS === 'android') {
const isLowRam = isLowRamDevice();
console.log(`Low RAM Device: ${isLowRam}`);
}Check for physical design features like notches and dynamic islands.
/**
* Check if device has a notch
* @returns True if device has a notch
* @platforms All (uses device database)
*/
function hasNotch(): boolean;
/**
* Check if device has dynamic island
* @returns True if device has dynamic island
* @platforms All (uses device database)
*/
function hasDynamicIsland(): boolean;Usage Examples:
import { hasNotch, hasDynamicIsland } from 'react-native-device-info';
// Physical design features
const deviceHasNotch = hasNotch();
const deviceHasDynamicIsland = hasDynamicIsland();
console.log(`Has Notch: ${deviceHasNotch}`);
console.log(`Has Dynamic Island: ${deviceHasDynamicIsland}`);
// Use for UI adjustments
const topSafeAreaAdjustment = deviceHasNotch || deviceHasDynamicIsland ? 44 : 20;iOS-specific device identification features.
/**
* Get device token for push notifications
* @returns Promise resolving to device token
* @platforms iOS
*/
function getDeviceToken(): Promise<string>;Usage Examples:
import { getDeviceToken } from 'react-native-device-info';
import { Platform } from 'react-native';
// iOS device token for push notifications
if (Platform.OS === 'ios') {
const deviceToken = await getDeviceToken();
console.log('Device Token:', deviceToken);
}type DeviceType = 'Handset' | 'Tablet' | 'Tv' | 'Desktop' | 'GamingConsole' | 'unknown';Install with Tessl CLI
npx tessl i tessl/npm-react-native-device-info