CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-react-native-device-info

Get device information using react-native

Pending
Overview
Eval results
Files

system-information.mddocs/

System Information

System and operating system information including OS version, build details, and platform-specific system properties. Critical for compatibility checks and platform-specific feature detection.

Capabilities

Operating System Information

Get basic operating system information.

/**
 * Get system/OS name
 * @returns OS name (e.g., "iOS", "Android", "Windows")
 * @platforms iOS, Android, Windows
 */
function getSystemName(): string;

/**
 * Get system/OS version
 * @returns OS version string
 * @platforms Android, iOS, Windows
 */
function getSystemVersion(): string;

/**
 * Get base OS information (async)
 * @returns Promise resolving to base OS string
 * @platforms Android, Web, Windows
 */
function getBaseOs(): Promise<string>;

/**
 * Get base OS information (sync)
 * @returns Base OS string
 * @platforms Android, Web, Windows
 */
function getBaseOsSync(): string;

Usage Examples:

import { getSystemName, getSystemVersion, getBaseOs } from 'react-native-device-info';

// Basic OS information
const osName = getSystemName();
const osVersion = getSystemVersion();
const baseOs = await getBaseOs();

console.log(`OS: ${osName} ${osVersion}`);
console.log(`Base OS: ${baseOs}`);

// Version compatibility check
const majorVersion = parseInt(osVersion.split('.')[0]);
if (osName === 'iOS' && majorVersion >= 14) {
  console.log('iOS 14+ features available');
}

Android API Level

Android-specific API level information.

/**
 * Get Android API level (async)
 * @returns Promise resolving to API level number
 * @platforms Android
 */
function getApiLevel(): Promise<number>;

/**
 * Get Android API level (sync)
 * @returns API level number
 * @platforms Android
 */
function getApiLevelSync(): number;

Usage Examples:

import { getApiLevel, getApiLevelSync } from 'react-native-device-info';
import { Platform } from 'react-native';

if (Platform.OS === 'android') {
  // Check API level for feature compatibility
  const apiLevel = await getApiLevel();
  console.log(`Android API Level: ${apiLevel}`);
  
  // Feature gating based on API level
  if (apiLevel >= 29) {
    console.log('Android 10+ features available');
  }
  
  // Sync version for startup logic
  const apiLevelSync = getApiLevelSync();
}

Build Information

Detailed build and version information.

/**
 * Get build ID (async)
 * @returns Promise resolving to build ID string
 * @platforms Android, iOS, Windows
 */
function getBuildId(): Promise<string>;

/**
 * Get build ID (sync)
 * @returns Build ID string
 * @platforms Android, iOS, Windows
 */
function getBuildIdSync(): string;

Usage Examples:

import { getBuildId, getBuildIdSync } from 'react-native-device-info';

// Get build information
const buildId = await getBuildId();
console.log(`Build ID: ${buildId}`);

// Sync version
const buildIdSync = getBuildIdSync();

Android Build Information

Detailed Android build information.

/**
 * Get bootloader version (async)
 * @returns Promise resolving to bootloader version
 * @platforms Android
 */
function getBootloader(): Promise<string>;

/**
 * Get bootloader version (sync)
 * @returns Bootloader version string
 * @platforms Android
 */
function getBootloaderSync(): string;

/**
 * Get OS codename (async)
 * @returns Promise resolving to OS codename
 * @platforms Android
 */
function getCodename(): Promise<string>;

/**
 * Get OS codename (sync)
 * @returns OS codename string
 * @platforms Android
 */
function getCodenameSync(): string;

/**
 * Get incremental version (async)
 * @returns Promise resolving to incremental version
 * @platforms Android
 */
function getIncremental(): Promise<string>;

/**
 * Get incremental version (sync)
 * @returns Incremental version string
 * @platforms Android
 */
function getIncrementalSync(): string;

/**
 * Get preview SDK int (async)
 * @returns Promise resolving to preview SDK int
 * @platforms Android
 */
function getPreviewSdkInt(): Promise<number>;

/**
 * Get preview SDK int (sync)
 * @returns Preview SDK int number
 * @platforms Android
 */
function getPreviewSdkIntSync(): number;

/**
 * Get security patch level (async)
 * @returns Promise resolving to security patch level
 * @platforms Android
 */
function getSecurityPatch(): Promise<string>;

/**
 * Get security patch level (sync)
 * @returns Security patch level string
 * @platforms Android
 */
function getSecurityPatchSync(): string;

Usage Examples:

import { 
  getBootloader, 
  getCodename, 
  getSecurityPatch,
  getPreviewSdkInt 
} from 'react-native-device-info';
import { Platform } from 'react-native';

if (Platform.OS === 'android') {
  // Detailed Android build info
  const bootloader = await getBootloader();
  const codename = await getCodename();
  const securityPatch = await getSecurityPatch();
  const previewSdk = await getPreviewSdkInt();
  
  console.log(`Bootloader: ${bootloader}`);
  console.log(`Codename: ${codename}`);
  console.log(`Security Patch: ${securityPatch}`);
  console.log(`Preview SDK: ${previewSdk}`);
}

Hardware Information

Low-level hardware information (primarily Android).

/**
 * Get device hardware name (async)
 * @returns Promise resolving to device hardware name
 * @platforms Android
 */
function getDevice(): Promise<string>;

/**
 * Get device hardware name (sync)
 * @returns Device hardware name string
 * @platforms Android
 */
function getDeviceSync(): string;

/**
 * Get display information (async)
 * @returns Promise resolving to display info
 * @platforms Android
 */
function getDisplay(): Promise<string>;

/**
 * Get display information (sync)
 * @returns Display info string
 * @platforms Android
 */
function getDisplaySync(): string;

/**
 * Get build fingerprint (async)
 * @returns Promise resolving to build fingerprint
 * @platforms Android
 */
function getFingerprint(): Promise<string>;

/**
 * Get build fingerprint (sync)
 * @returns Build fingerprint string
 * @platforms Android
 */
function getFingerprintSync(): string;

/**
 * Get hardware name (async)
 * @returns Promise resolving to hardware name
 * @platforms Android
 */
function getHardware(): Promise<string>;

/**
 * Get hardware name (sync)
 * @returns Hardware name string
 * @platforms Android
 */
function getHardwareSync(): string;

/**
 * Get host information (async)
 * @returns Promise resolving to host info
 * @platforms Android, Windows
 */
function getHost(): Promise<string>;

/**
 * Get host information (sync)
 * @returns Host info string
 * @platforms Android, Windows
 */
function getHostSync(): string;

/**
 * Get product name (async)
 * @returns Promise resolving to product name
 * @platforms Android
 */
function getProduct(): Promise<string>;

/**
 * Get product name (sync)
 * @returns Product name string
 * @platforms Android
 */
function getProductSync(): string;

/**
 * Get build tags (async)
 * @returns Promise resolving to build tags
 * @platforms Android
 */
function getTags(): Promise<string>;

/**
 * Get build tags (sync)
 * @returns Build tags string
 * @platforms Android
 */
function getTagsSync(): string;

/**
 * Get build type (async)
 * @returns Promise resolving to build type
 * @platforms Android
 */
function getType(): Promise<string>;

/**
 * Get build type (sync)
 * @returns Build type string
 * @platforms Android
 */
function getTypeSync(): string;

Windows-Specific Information

Windows-specific system information.

/**
 * Get host names (async)
 * @returns Promise resolving to array of host names
 * @platforms Windows
 */
function getHostNames(): Promise<string[]>;

/**
 * Get host names (sync)
 * @returns Array of host names
 * @platforms Windows
 */
function getHostNamesSync(): string[];

/**
 * Check if in tablet mode
 * @returns Promise resolving to true if in tablet mode
 * @platforms Windows
 */
function isTabletMode(): Promise<boolean>;

Usage Examples:

import { getHostNames, isTabletMode } from 'react-native-device-info';
import { Platform } from 'react-native';

if (Platform.OS === 'windows') {
  // Windows-specific information
  const hostNames = await getHostNames();
  const inTabletMode = await isTabletMode();
  
  console.log(`Host Names: ${hostNames.join(', ')}`);
  console.log(`Tablet Mode: ${inTabletMode}`);
}

Platform Features and Support

Check for platform-specific features and services.

/**
 * Check for Google Mobile Services (async)
 * @returns Promise resolving to true if GMS available
 * @platforms Android
 */
function hasGms(): Promise<boolean>;

/**
 * Check for Google Mobile Services (sync)
 * @returns True if GMS available
 * @platforms Android
 */
function hasGmsSync(): boolean;

/**
 * Check for Huawei Mobile Services (async)
 * @returns Promise resolving to true if HMS available
 * @platforms Android
 */
function hasHms(): Promise<boolean>;

/**
 * Check for Huawei Mobile Services (sync)
 * @returns True if HMS available
 * @platforms Android
 */
function hasHmsSync(): boolean;

/**
 * Check for specific system feature (async)
 * @param feature - Feature name to check
 * @returns Promise resolving to true if feature available
 * @platforms Android
 */
function hasSystemFeature(feature: string): Promise<boolean>;

/**
 * Check for specific system feature (sync)
 * @param feature - Feature name to check
 * @returns True if feature available
 * @platforms Android
 */
function hasSystemFeatureSync(feature: string): boolean;

/**
 * Get all available system features (async)
 * @returns Promise resolving to array of feature names
 * @platforms Android
 */
function getSystemAvailableFeatures(): Promise<string[]>;

/**
 * Get all available system features (sync)
 * @returns Array of feature names
 * @platforms Android
 */
function getSystemAvailableFeaturesSync(): string[];

Usage Examples:

import { 
  hasGms, 
  hasHms, 
  hasSystemFeature, 
  getSystemAvailableFeatures 
} from 'react-native-device-info';
import { Platform } from 'react-native';

if (Platform.OS === 'android') {
  // Check for mobile services
  const hasGoogleServices = await hasGms();
  const hasHuaweiServices = await hasHms();
  
  console.log(`Google Services: ${hasGoogleServices}`);
  console.log(`Huawei Services: ${hasHuaweiServices}`);
  
  // Check for specific features
  const hasCamera = await hasSystemFeature('android.hardware.camera');
  const hasNfc = await hasSystemFeature('android.hardware.nfc');
  
  console.log(`Camera: ${hasCamera}`);
  console.log(`NFC: ${hasNfc}`);
  
  // Get all available features
  const allFeatures = await getSystemAvailableFeatures();
  console.log(`Available features: ${allFeatures.length}`);
}

Architecture and ABI Support

Get supported architectures and ABIs.

/**
 * Get supported ABIs (async)
 * @returns Promise resolving to array of supported ABIs
 * @platforms Android, iOS, Windows
 */
function supportedAbis(): Promise<string[]>;

/**
 * Get supported ABIs (sync)
 * @returns Array of supported ABIs
 * @platforms Android, iOS, Windows
 */
function supportedAbisSync(): string[];

/**
 * Get supported 32-bit ABIs (async)
 * @returns Promise resolving to array of 32-bit ABIs
 * @platforms Android
 */
function supported32BitAbis(): Promise<string[]>;

/**
 * Get supported 32-bit ABIs (sync)
 * @returns Array of 32-bit ABIs
 * @platforms Android
 */
function supported32BitAbisSync(): string[];

/**
 * Get supported 64-bit ABIs (async)
 * @returns Promise resolving to array of 64-bit ABIs
 * @platforms Android
 */
function supported64BitAbis(): Promise<string[]>;

/**
 * Get supported 64-bit ABIs (sync)
 * @returns Array of 64-bit ABIs
 * @platforms Android
 */
function supported64BitAbisSync(): string[];

Usage Examples:

import { 
  supportedAbis, 
  supported32BitAbis, 
  supported64BitAbis 
} from 'react-native-device-info';

// Get architecture support
const abis = await supportedAbis();
console.log(`Supported ABIs: ${abis.join(', ')}`);

if (Platform.OS === 'android') {
  const abis32 = await supported32BitAbis();
  const abis64 = await supported64BitAbis();
  
  console.log(`32-bit ABIs: ${abis32.join(', ')}`);
  console.log(`64-bit ABIs: ${abis64.join(', ')}`);
  
  // Check for 64-bit support
  const has64BitSupport = abis64.length > 0;
  console.log(`64-bit support: ${has64BitSupport}`);
}

Device State and Orientation

Get device state and orientation information.

/**
 * Check if device is in landscape orientation (async)
 * @returns Promise resolving to true if landscape
 * @platforms Android, iOS, Windows, Web
 */
function isLandscape(): Promise<boolean>;

/**
 * Check if device is in landscape orientation (sync)
 * @returns True if landscape orientation
 * @platforms Android, iOS, Windows, Web
 */
function isLandscapeSync(): boolean;

/**
 * Get font scale factor (async)
 * @returns Promise resolving to font scale factor
 * @platforms Android, iOS, Windows
 */
function getFontScale(): Promise<number>;

/**
 * Get font scale factor (sync)
 * @returns Font scale factor
 * @platforms Android, iOS, Windows
 */
function getFontScaleSync(): number;

/**
 * Check if PIN or fingerprint is set (async)
 * @returns Promise resolving to true if security is enabled
 * @platforms Android, iOS, Windows
 */
function isPinOrFingerprintSet(): Promise<boolean>;

/**
 * Check if PIN or fingerprint is set (sync)
 * @returns True if security is enabled
 * @platforms Android, iOS, Windows
 */
function isPinOrFingerprintSetSync(): boolean;

Usage Examples:

import { 
  isLandscape, 
  getFontScale, 
  isPinOrFingerprintSet 
} from 'react-native-device-info';

// Device state information
const landscapeMode = await isLandscape();
const fontScale = await getFontScale();
const hasSecuritySet = await isPinOrFingerprintSet();

console.log(`Landscape: ${landscapeMode}`);
console.log(`Font Scale: ${fontScale}`);
console.log(`Security Enabled: ${hasSecuritySet}`);

// Use for UI adjustments
const adjustedFontSize = 16 * fontScale;

Performance and Startup

Application performance and startup metrics.

/**
 * Get app startup time (async)
 * @returns Promise resolving to startup time in milliseconds
 * @platforms Android, iOS, Windows
 */
function getStartupTime(): Promise<number>;

/**
 * Get app startup time (sync)
 * @returns Startup time in milliseconds
 * @platforms Android, iOS, Windows
 */
function getStartupTimeSync(): number;

Usage Examples:

import { getStartupTime } from 'react-native-device-info';

// Performance monitoring
const startupTime = await getStartupTime();
console.log(`App startup time: ${startupTime}ms`);

// Performance analytics
if (startupTime > 3000) {
  console.log('Slow startup detected');
}

User Agent and Web Information

Get user agent and web-related information.

/**
 * Get user agent string (async)
 * @returns Promise resolving to user agent
 * @platforms Android, iOS, Windows, Web
 */
function getUserAgent(): Promise<string>;

/**
 * Get user agent string (sync)
 * @returns User agent string
 * @platforms Android, iOS, Windows, Web
 */
function getUserAgentSync(): string;

Usage Examples:

import { getUserAgent } from 'react-native-device-info';

// Web compatibility information
const userAgent = await getUserAgent();
console.log(`User Agent: ${userAgent}`);

// Parse for specific capabilities
const isWebKit = userAgent.includes('WebKit');
const isChrome = userAgent.includes('Chrome');

Install with Tessl CLI

npx tessl i tessl/npm-react-native-device-info

docs

application-information.md

battery-power.md

device-identification.md

hardware-features.md

index.md

memory-storage.md

network-connectivity.md

react-hooks.md

system-information.md

tile.json