UNPKG

react-native-device-info

Version:
1,012 lines (948 loc) 137 kB
import { useCallback, useEffect, useState } from 'react'; import { Dimensions, NativeEventEmitter, NativeModules, Platform } from 'react-native'; import { useOnEvent, useOnMount } from './internal/asyncHookWrappers'; import devicesWithDynamicIsland from './internal/devicesWithDynamicIsland'; import devicesWithNotch from './internal/devicesWithNotch'; import RNDeviceInfo from './internal/nativeInterface'; import { getSupportedPlatformInfoAsync, getSupportedPlatformInfoFunctions, getSupportedPlatformInfoSync } from './internal/supported-platform-info'; const [getUniqueIdInternal, getUniqueIdSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'uniqueId', supportedPlatforms: ['android', 'ios', 'windows'], getter: () => RNDeviceInfo.getUniqueId(), syncGetter: () => RNDeviceInfo.getUniqueIdSync(), defaultValue: 'unknown' }); /** * Retrieves the unique ID information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getUniqueId(); * ``` */ export const getUniqueId = getUniqueIdInternal; /** * Synchronous variant of {@link getUniqueId}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getUniqueIdSync(); * ``` */ export const getUniqueIdSync = getUniqueIdSyncInternal; let uniqueId; /** * Preloads the unique ID on iOS so that {@link getUniqueId} can resolve synchronously later in the app lifecycle. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await syncUniqueId(); * ``` */ export async function syncUniqueId() { if (Platform.OS === 'ios') { uniqueId = await RNDeviceInfo.syncUniqueId(); } else { uniqueId = await getUniqueId(); } return uniqueId; } const [getInstanceIdInternal, getInstanceIdSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'instanceId', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getInstanceId(), syncGetter: () => RNDeviceInfo.getInstanceIdSync(), defaultValue: 'unknown' }); /** * Retrieves the instance ID information reported by the native platform. * @example * ```ts * const result = await getInstanceId(); * ``` */ export const getInstanceId = getInstanceIdInternal; /** * Synchronous variant of {@link getInstanceId}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getInstanceIdSync(); * ``` */ export const getInstanceIdSync = getInstanceIdSyncInternal; const [getSerialNumberInternal, getSerialNumberSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'serialNumber', supportedPlatforms: ['android', 'windows'], getter: () => RNDeviceInfo.getSerialNumber(), syncGetter: () => RNDeviceInfo.getSerialNumberSync(), defaultValue: 'unknown' }); /** * Retrieves the serial number information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getSerialNumber(); * ``` */ export const getSerialNumber = getSerialNumberInternal; /** * Synchronous variant of {@link getSerialNumber}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getSerialNumberSync(); * ``` */ export const getSerialNumberSync = getSerialNumberSyncInternal; const [getAndroidIdInternal, getAndroidIdSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'androidId', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getAndroidId(), syncGetter: () => RNDeviceInfo.getAndroidIdSync(), defaultValue: 'unknown' }); /** * Retrieves the Android ID information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getAndroidId(); * ``` */ export const getAndroidId = getAndroidIdInternal; /** * Synchronous variant of {@link getAndroidId}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getAndroidIdSync(); * ``` */ export const getAndroidIdSync = getAndroidIdSyncInternal; /** * Retrieves the app set ID information reported by the native platform. * *![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getAppSetId(); * ``` */ export const getAppSetId = () => getSupportedPlatformInfoAsync({ memoKey: 'appSetId', defaultValue: { id: 'unknown', scope: -1 }, supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getAppSetId() }); const [getIpAddressInternal, getIpAddressSyncInternal] = getSupportedPlatformInfoFunctions({ supportedPlatforms: ['android', 'ios', 'windows'], getter: () => RNDeviceInfo.getIpAddress(), syncGetter: () => RNDeviceInfo.getIpAddressSync(), defaultValue: 'unknown' }); /** * Retrieves the IP address information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getIpAddress(); * ``` */ export const getIpAddress = getIpAddressInternal; /** * Synchronous variant of {@link getIpAddress}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getIpAddressSync(); * ``` */ export const getIpAddressSync = getIpAddressSyncInternal; const [isCameraPresentInternal, isCameraPresentSyncInternal] = getSupportedPlatformInfoFunctions({ supportedPlatforms: ['android', 'windows', 'web'], getter: () => RNDeviceInfo.isCameraPresent(), syncGetter: () => RNDeviceInfo.isCameraPresentSync(), defaultValue: false }); /** * Returns true when at least one hardware camera is available on the device. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ✅](https://img.shields.io/badge/Web-%E2%9C%85-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await isCameraPresent(); * ``` */ export const isCameraPresent = isCameraPresentInternal; /** * Synchronous variant of {@link isCameraPresent}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ✅](https://img.shields.io/badge/Web-%E2%9C%85-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = isCameraPresentSync(); * ``` */ export const isCameraPresentSync = isCameraPresentSyncInternal; /** * Retrieves the WiFi MAC address on Android and returns a constant placeholder for other platforms. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getMacAddress(); * ``` */ export async function getMacAddress() { if (Platform.OS === 'android') { return RNDeviceInfo.getMacAddress(); } else if (Platform.OS === 'ios') { return '02:00:00:00:00:00'; } return 'unknown'; } /** * Synchronous variant of {@link getMacAddress}. * * @example * ```ts * const result = getMacAddressSync(); * ``` */ export function getMacAddressSync() { if (Platform.OS === 'android') { return RNDeviceInfo.getMacAddressSync(); } else if (Platform.OS === 'ios') { return '02:00:00:00:00:00'; } return 'unknown'; } /** * Retrieves the device ID information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getDeviceId(); * ``` */ export const getDeviceId = () => getSupportedPlatformInfoSync({ defaultValue: 'unknown', memoKey: 'deviceId', getter: () => RNDeviceInfo.deviceId, supportedPlatforms: ['android', 'ios', 'windows'] }); const [getManufacturerInternal, getManufacturerSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'manufacturer', supportedPlatforms: ['android', 'ios', 'windows'], getter: () => Platform.OS == 'ios' ? Promise.resolve('Apple') : RNDeviceInfo.getSystemManufacturer(), syncGetter: () => Platform.OS == 'ios' ? 'Apple' : RNDeviceInfo.getSystemManufacturerSync(), defaultValue: 'unknown' }); /** * Retrieves the manufacturer information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getManufacturer(); * ``` */ export const getManufacturer = getManufacturerInternal; /** * Synchronous variant of {@link getManufacturer}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getManufacturerSync(); * ``` */ export const getManufacturerSync = getManufacturerSyncInternal; /** * Retrieves the model information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getModel(); * ``` */ export const getModel = () => getSupportedPlatformInfoSync({ memoKey: 'model', defaultValue: 'unknown', supportedPlatforms: ['ios', 'android', 'windows'], getter: () => RNDeviceInfo.model }); /** * Retrieves the brand information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getBrand(); * ``` */ export const getBrand = () => getSupportedPlatformInfoSync({ memoKey: 'brand', supportedPlatforms: ['android', 'ios', 'windows'], defaultValue: 'unknown', getter: () => RNDeviceInfo.brand }); /** * Retrieves the system name information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getSystemName(); * ``` */ export const getSystemName = () => getSupportedPlatformInfoSync({ defaultValue: 'unknown', supportedPlatforms: ['ios', 'android', 'windows'], memoKey: 'systemName', getter: () => Platform.select({ ios: RNDeviceInfo.systemName, android: 'Android', windows: 'Windows', default: 'unknown' }) }); /** * Retrieves the system version information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getSystemVersion(); * ``` */ export const getSystemVersion = () => getSupportedPlatformInfoSync({ defaultValue: 'unknown', getter: () => RNDeviceInfo.systemVersion, supportedPlatforms: ['android', 'ios', 'windows'], memoKey: 'systemVersion' }); const [getBuildIdInternal, getBuildIdSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'buildId', supportedPlatforms: ['android', 'ios', 'windows'], getter: () => RNDeviceInfo.getBuildId(), syncGetter: () => RNDeviceInfo.getBuildIdSync(), defaultValue: 'unknown' }); /** * Retrieves the build ID information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getBuildId(); * ``` */ export const getBuildId = getBuildIdInternal; /** * Synchronous variant of {@link getBuildId}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getBuildIdSync(); * ``` */ export const getBuildIdSync = getBuildIdSyncInternal; const [getApiLevelInternal, getApiLevelSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'apiLevel', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getApiLevel(), syncGetter: () => RNDeviceInfo.getApiLevelSync(), defaultValue: -1 }); /** * Retrieves the API level information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getApiLevel(); * ``` */ export const getApiLevel = getApiLevelInternal; /** * Synchronous variant of {@link getApiLevel}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getApiLevelSync(); * ``` */ export const getApiLevelSync = getApiLevelSyncInternal; /** * Retrieves the bundle ID information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getBundleId(); * ``` */ export const getBundleId = () => getSupportedPlatformInfoSync({ memoKey: 'bundleId', supportedPlatforms: ['android', 'ios', 'windows'], defaultValue: 'unknown', getter: () => RNDeviceInfo.bundleId }); const [getInstallerPackageNameInternal, getInstallerPackageNameSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'installerPackageName', supportedPlatforms: ['android', 'windows', 'ios'], getter: () => RNDeviceInfo.getInstallerPackageName(), syncGetter: () => RNDeviceInfo.getInstallerPackageNameSync(), defaultValue: 'unknown' }); /** * Retrieves the installer package name information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getInstallerPackageName(); * ``` */ export const getInstallerPackageName = getInstallerPackageNameInternal; /** * Synchronous variant of {@link getInstallerPackageName}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getInstallerPackageNameSync(); * ``` */ export const getInstallerPackageNameSync = getInstallerPackageNameSyncInternal; /** * Retrieves the application name information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getApplicationName(); * ``` */ export const getApplicationName = () => getSupportedPlatformInfoSync({ memoKey: 'appName', defaultValue: 'unknown', getter: () => RNDeviceInfo.appName, supportedPlatforms: ['android', 'ios', 'windows'] }); /** * Retrieves the build number information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getBuildNumber(); * ``` */ export const getBuildNumber = () => getSupportedPlatformInfoSync({ memoKey: 'buildNumber', supportedPlatforms: ['android', 'ios', 'windows'], getter: () => RNDeviceInfo.buildNumber, defaultValue: 'unknown' }); /** * Retrieves the version information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getVersion(); * ``` */ export const getVersion = () => getSupportedPlatformInfoSync({ memoKey: 'version', defaultValue: 'unknown', supportedPlatforms: ['android', 'ios', 'windows'], getter: () => RNDeviceInfo.appVersion }); /** * Retrieves the readable version information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getReadableVersion(); * ``` */ export function getReadableVersion() { return getVersion() + '.' + getBuildNumber(); } const [getDeviceNameInternal, getDeviceNameSyncInternal] = getSupportedPlatformInfoFunctions({ supportedPlatforms: ['android', 'ios', 'windows'], getter: () => RNDeviceInfo.getDeviceName(), syncGetter: () => RNDeviceInfo.getDeviceNameSync(), defaultValue: 'unknown' }); /** * Retrieves the device name information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getDeviceName(); * ``` */ export const getDeviceName = getDeviceNameInternal; /** * Synchronous variant of {@link getDeviceName}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getDeviceNameSync(); * ``` */ export const getDeviceNameSync = getDeviceNameSyncInternal; const [getUsedMemoryInternal, getUsedMemorySyncInternal] = getSupportedPlatformInfoFunctions({ supportedPlatforms: ['android', 'ios', 'windows', 'web'], getter: () => RNDeviceInfo.getUsedMemory(), syncGetter: () => RNDeviceInfo.getUsedMemorySync(), defaultValue: -1 }); /** * Retrieves the used memory information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ✅](https://img.shields.io/badge/Web-%E2%9C%85-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getUsedMemory(); * ``` */ export const getUsedMemory = getUsedMemoryInternal; /** * Synchronous variant of {@link getUsedMemory}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ✅](https://img.shields.io/badge/Web-%E2%9C%85-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getUsedMemorySync(); * ``` */ export const getUsedMemorySync = getUsedMemorySyncInternal; /** * Retrieves the user agent information reported by the native platform. * *![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ✅](https://img.shields.io/badge/Web-%E2%9C%85-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getUserAgent(); * ``` */ export const getUserAgent = () => getSupportedPlatformInfoAsync({ memoKey: 'userAgent', defaultValue: 'unknown', supportedPlatforms: ['android', 'ios', 'web'], getter: () => RNDeviceInfo.getUserAgent() }); /** * Synchronous variant of {@link getUserAgent}. * *![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ✅](https://img.shields.io/badge/Web-%E2%9C%85-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getUserAgentSync(); * ``` */ export const getUserAgentSync = () => getSupportedPlatformInfoSync({ memoKey: 'userAgentSync', defaultValue: 'unknown', supportedPlatforms: ['android', 'web'], getter: () => RNDeviceInfo.getUserAgentSync() }); const [getFontScaleInternal, getFontScaleSyncInternal] = getSupportedPlatformInfoFunctions({ supportedPlatforms: ['android', 'ios', 'windows'], getter: () => RNDeviceInfo.getFontScale(), syncGetter: () => RNDeviceInfo.getFontScaleSync(), defaultValue: -1 }); /** * Retrieves the font scale information reported by the native platform. * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = await getFontScale(); * ``` */ export const getFontScale = getFontScaleInternal; /** * Synchronous variant of {@link getFontScale}. * * * **Compatibility:** ![iOS ✅](https://img.shields.io/badge/iOS-%E2%9C%85-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ✅](https://img.shields.io/badge/visionOS-%E2%9C%85-informational?labelColor=555555) * * @example * ```ts * const result = getFontScaleSync(); * ``` */ export const getFontScaleSync = getFontScaleSyncInternal; const [getBootloaderInternal, getBootloaderSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'bootloader', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getBootloader(), syncGetter: () => RNDeviceInfo.getBootloaderSync(), defaultValue: 'unknown' }); /** * Retrieves the bootloader information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getBootloader(); * ``` */ export const getBootloader = getBootloaderInternal; /** * Synchronous variant of {@link getBootloader}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getBootloaderSync(); * ``` */ export const getBootloaderSync = getBootloaderSyncInternal; const [getDeviceInternal, getDeviceSyncInternal] = getSupportedPlatformInfoFunctions({ getter: () => RNDeviceInfo.getDevice(), syncGetter: () => RNDeviceInfo.getDeviceSync(), defaultValue: 'unknown', memoKey: 'device', supportedPlatforms: ['android'] }); /** * Retrieves the device information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getDevice(); * ``` */ export const getDevice = getDeviceInternal; /** * Synchronous variant of {@link getDevice}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getDeviceSync(); * ``` */ export const getDeviceSync = getDeviceSyncInternal; const [getDisplayInternal, getDisplaySyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'display', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getDisplay(), syncGetter: () => RNDeviceInfo.getDisplaySync(), defaultValue: 'unknown' }); /** * Retrieves the display information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getDisplay(); * ``` */ export const getDisplay = getDisplayInternal; /** * Synchronous variant of {@link getDisplay}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getDisplaySync(); * ``` */ export const getDisplaySync = getDisplaySyncInternal; const [getFingerprintInternal, getFingerprintSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'fingerprint', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getFingerprint(), syncGetter: () => RNDeviceInfo.getFingerprintSync(), defaultValue: 'unknown' }); /** * Retrieves the fingerprint information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getFingerprint(); * ``` */ export const getFingerprint = getFingerprintInternal; /** * Synchronous variant of {@link getFingerprint}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getFingerprintSync(); * ``` */ export const getFingerprintSync = getFingerprintSyncInternal; const [getHardwareInternal, getHardwareSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'hardware', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getHardware(), syncGetter: () => RNDeviceInfo.getHardwareSync(), defaultValue: 'unknown' }); /** * Retrieves the hardware information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getHardware(); * ``` */ export const getHardware = getHardwareInternal; /** * Synchronous variant of {@link getHardware}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getHardwareSync(); * ``` */ export const getHardwareSync = getHardwareSyncInternal; const [getHostInternal, getHostSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'host', supportedPlatforms: ['android', 'windows'], getter: () => RNDeviceInfo.getHost(), syncGetter: () => RNDeviceInfo.getHostSync(), defaultValue: 'unknown' }); /** * Retrieves the host information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getHost(); * ``` */ export const getHost = getHostInternal; /** * Synchronous variant of {@link getHost}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getHostSync(); * ``` */ export const getHostSync = getHostSyncInternal; const [getHostNamesInternal, getHostNamesSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'hostNames', supportedPlatforms: ['windows'], getter: () => RNDeviceInfo.getHostNames(), syncGetter: () => RNDeviceInfo.getHostNamesSync(), defaultValue: [] }); /** * Retrieves the host names information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ❌](https://img.shields.io/badge/Android-%E2%9D%8C-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getHostNames(); * ``` */ export const getHostNames = getHostNamesInternal; /** * Synchronous variant of {@link getHostNames}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ❌](https://img.shields.io/badge/Android-%E2%9D%8C-informational?labelColor=555555) ![Windows ✅](https://img.shields.io/badge/Windows-%E2%9C%85-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getHostNamesSync(); * ``` */ export const getHostNamesSync = getHostNamesSyncInternal; const [getProductInternal, getProductSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'product', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getProduct(), syncGetter: () => RNDeviceInfo.getProductSync(), defaultValue: 'unknown' }); /** * Retrieves the product information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getProduct(); * ``` */ export const getProduct = getProductInternal; /** * Synchronous variant of {@link getProduct}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getProductSync(); * ``` */ export const getProductSync = getProductSyncInternal; const [getTagsInternal, getTagsSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'tags', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getTags(), syncGetter: () => RNDeviceInfo.getTagsSync(), defaultValue: 'unknown' }); /** * Retrieves the tags information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getTags(); * ``` */ export const getTags = getTagsInternal; /** * Synchronous variant of {@link getTags}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = getTagsSync(); * ``` */ export const getTagsSync = getTagsSyncInternal; const [getTypeInternal, getTypeSyncInternal] = getSupportedPlatformInfoFunctions({ memoKey: 'type', supportedPlatforms: ['android'], getter: () => RNDeviceInfo.getType(), syncGetter: () => RNDeviceInfo.getTypeSync(), defaultValue: 'unknown' }); /** * Retrieves the type information reported by the native platform. * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D%8C-informational?labelColor=555555) * * @example * ```ts * const result = await getType(); * ``` */ export const getType = getTypeInternal; /** * Synchronous variant of {@link getType}. * * * **Compatibility:** ![iOS ❌](https://img.shields.io/badge/iOS-%E2%9D%8C-informational?labelColor=555555) ![Android ✅](https://img.shields.io/badge/Android-%E2%9C%85-informational?labelColor=555555) ![Windows ❌](https://img.shields.io/badge/Windows-%E2%9D%8C-informational?labelColor=555555) ![Web ❌](https://img.shields.io/badge/Web-%E2%9D%8C-informational?labelColor=555555) ![visionOS ❌](https://img.shields.io/badge/visionOS-%E2%9D