### useFirstInstallTime hook example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useFirstInstallTime.html
Use this hook to get the app's first install timestamp. The result is a number (timestamp) that can be formatted with Date methods. The example renders the date using toLocaleDateString().
```javascript
function InstallAge() {
const { result } = useFirstInstallTime();
return {new Date(result).toLocaleDateString()};
}
```
--------------------------------
### getFirstInstallTime()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the app's first installation time in milliseconds.
```javascript
DeviceInfo.getFirstInstallTime().then((firstInstallTime) => {
// Android: 1517681764528
});
```
--------------------------------
### Usage of getFirstInstallTimeSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getFirstInstallTimeSync.html
A basic example showing how to call the synchronous getFirstInstallTimeSync function to retrieve the application's first install time.
```javascript
const result = getFirstInstallTimeSync();
```
--------------------------------
### getPreviewSdkInt() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the developer preview revision of a prerelease SDK. The example shows a promise resolving to an integer.
```javascript
DeviceInfo.getPreviewSdkInt().then((previewSdkInt) => {
// 0
});
```
--------------------------------
### getProduct() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the name of the overall product. The example shows a promise resolving to a product name string.
```javascript
DeviceInfo.getProduct().then((product) => {
// "walleye"
});
```
--------------------------------
### getInstallReferrer()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the referrer string from application installation.
```javascript
DeviceInfo.getInstallReferrer().then((installReferrer) => {
```
--------------------------------
### Install via yarn
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Command to install the library using yarn.
```bash
yarn add react-native-device-info
```
--------------------------------
### Install via npm
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Command to install the library using npm.
```bash
npm install --save react-native-device-info
```
--------------------------------
### getInstanceId() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the application instance ID. The example shows a promise that resolves to an instance ID string, with a comment indicating an Android example value.
```javascript
DeviceInfo.getInstanceId().then((instanceId) => {
// Android: da4e0245-5d6c-402a-a07c-0c5349f229e2
});
```
--------------------------------
### getBootloader usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getBootloader.html
Call getBootloader to retrieve the bootloader information as a string. The function returns a Promise, so use await to get the result.
```javascript
const result = await getBootloader();
```
--------------------------------
### getReadableVersion() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the application human readable version (same as getVersion() + '.' + getBuildNumber()). The example shows a synchronous call returning a version string.
```javascript
let readableVersion = DeviceInfo.getReadableVersion();
// iOS: 1.0.1.32
// Android: 1.0.1.234
// Windows: ?
```
--------------------------------
### Importing DeviceInfo
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Standard and destructured import examples for the library.
```javascript
import DeviceInfo from 'react-native-device-info';
// or ES6+ destructured imports
import { getUniqueId, getManufacturer } from 'react-native-device-info';
```
--------------------------------
### getHost Usage Example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getHost.html
Example showing how to use the getHost getter to retrieve host information. It awaits the promise and stores the result in a constant.
```typescript
const result = await getHost();
```
--------------------------------
### Usage of getInstallReferrerSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstallReferrerSync.html
Retrieves the install referrer synchronously.
```javascript
const result = getInstallReferrerSync();
```
--------------------------------
### getInstallerPackageNameSync() example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstallerPackageNameSync.html
Synchronous variant of getInstallerPackageName. Returns the installer package name synchronously.
```javascript
const result = getInstallerPackageNameSync();
```
--------------------------------
### getSecurityPatch() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the user-visible security patch level. The example shows a promise resolving to a date string.
```javascript
DeviceInfo.getSecurityPatch().then((securityPatch) => {
// "2018-07-05"
});
```
--------------------------------
### Proguard configuration for Install Referrer
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Proguard rule required for Install Referrer tracking.
```text
-keep class com.android.installreferrer.api.** {
*;
}
```
--------------------------------
### Usage with await
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getFirstInstallTime.html
Retrieves the first install time by awaiting the getter. The result is a number (timestamp in milliseconds).
```text
const result = await getFirstInstallTime();
```
--------------------------------
### Get Base OS
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the base OS build the product is based on.
```javascript
DeviceInfo.getBaseOs().then((baseOs) => {
// "Windows", "Android" etc
});
```
--------------------------------
### getPowerState() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the power state of the device including battery level, plugged-in status, and low power mode. The example shows a promise resolving to an object with batteryLevel, batteryState, and lowPowerMode.
```javascript
DeviceInfo.getPowerState().then((state) => {
// {
// batteryLevel: 0.759999,
// batteryState: 'unplugged',
// lowPowerMode: false,
// }
});
```
--------------------------------
### Retrieve install referrer
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstallReferrer.html
Retrieves the install referrer information reported by the native platform.
```javascript
const result = await getInstallReferrer();
```
--------------------------------
### getModel() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device model. The example shows a synchronous call returning a model string. Note: iOS device names are community-maintained and may lag new devices.
```javascript
let model = DeviceInfo.getModel();
// iOS: ?
// Android: ?
// Windows: ?
```
--------------------------------
### getSystemVersion usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getSystemVersion.html
Retrieves the system version information reported by the native platform.
```javascript
const result = getSystemVersion();
```
--------------------------------
### getFirstInstallTimeSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getFirstInstallTimeSync.html
Synchronous variant of getFirstInstallTime. Returns the first install time as a number.
```APIDOC
## getFirstInstallTimeSync
### Description
Synchronous variant of getFirstInstallTime. Returns the first install time as a number.
### Method
Synchronous getter
### Signature
`getFirstInstallTimeSync: Getter`
### Returns
- **number** - The first install time.
### Example
```
const result = getFirstInstallTimeSync();
```
### Compatibility
Compatible with the platform.
```
--------------------------------
### getInstallReferrerSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstallReferrerSync.html
Synchronous variant of getInstallReferrer. Returns the install referrer as a string.
```APIDOC
## getInstallReferrerSync
### Description
Synchronous variant of getInstallReferrer. Returns the install referrer as a string.
### Method
Synchronous getter
### Endpoint
`getInstallReferrerSync()`
### Parameters
None
### Request Example
```js
const result = getInstallReferrerSync();
```
### Response
#### Success Response
- **result** (string) - The install referrer value.
#### Response Example
```js
const result = getInstallReferrerSync();
```
```
--------------------------------
### getFirstInstallTime
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getFirstInstallTime.html
Retrieves the first install time information reported by the native platform. Returns a Promise that resolves to a number.
```APIDOC
## getFirstInstallTime
### Description
Retrieves the first install time information reported by the native platform.
### Method
Const Getter
### Returns
Promise - The first install time as a number.
### Example
```
const result = await getFirstInstallTime();
```
```
--------------------------------
### Get supported 32-bit ABIs
Source: https://react-native-device-info.github.io/react-native-device-info/variables/supported32BitAbis.html
Use this snippet to retrieve the list of supported 32-bit ABIs from the native platform. The function returns a Promise that resolves to an array of strings. This example is compatible with the current version of the library.
```javascript
const result = await supported32BitAbis();
```
--------------------------------
### AndroidX build.gradle configuration
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Example configuration for library versions in the android/build.gradle file's ext block.
```gradle
...
ext {
// dependency versions
We have 3 options for deviceId:
//Option 1 (latest):
firebaseIidVersion = "19.0.1" // default: "19.0.1"
//Option 2 (legacy GooglePlay dependency but using AndroidX):
googlePlayServicesIidVersion = "17.0.0" // default: "17.0.0" - AndroidX
//Option 3 (legacy GooglePlay dependency before AndroidX):
googlePlayServicesIidVersion = "16.0.1"
// getAppSetId() - optional: set to include play-services-appset (e.g. "16.1.0")
// playServicesAppSetVersion = "16.1.0"
//include as needed:
compileSdkVersion = "28" // default: 28 (28 is required for AndroidX)
targetSdkVersion = "28" // default: 28 (28 is required for AndroidX)
supportLibVersion = '1.0.2' // Use '28.0.0' or don't specify for old libraries, '1.0.2' or similar for AndroidX
mediaCompatVersion = '1.0.1' // Do not specify if using old libraries, specify '1.0.1' or similar for androidx.media:media dependency
supportV4Version = '1.0.0' // Do not specify if using old libraries, specify '1.0.0' or similar for androidx.legacy:legacy-support-v4 dependency
}
...
```
--------------------------------
### getLastUpdateTime() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the time at which the app was last updated, in milliseconds. The example shows a promise resolving to a timestamp.
```javascript
DeviceInfo.getLastUpdateTime().then((lastUpdateTime) => {
// Android: 1517681764992
});
```
--------------------------------
### hasNotch() usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/hasNotch.html
Call hasNotch() to get a boolean indicating if the device has a notch. The example shows the function call and the result is a boolean.
```javascript
const result = hasNotch();
```
--------------------------------
### getSystemName usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getSystemName.html
Call getSystemName() to retrieve the system name string. The example shows the function call without any arguments.
```javascript
const result = getSystemName();
```
--------------------------------
### getMacAddress() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the network adapter MAC address. The example shows a promise resolving to a MAC address string. Note: iOS always returns '02:00:00:00:00:00'.
```javascript
DeviceInfo.getMacAddress().then((mac) => {
// "E5:12:D8:E5:69:97"
});
```
--------------------------------
### getBrand Example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getBrand.html
Calls getBrand to retrieve the device brand as a string.
```javascript
const result = getBrand();
```
--------------------------------
### getManufacturer() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device manufacturer. The example shows a promise resolving to a manufacturer string, with comments for iOS, Android, and Windows.
```javascript
DeviceInfo.getManufacturer().then((manufacturer) => {
// iOS: "Apple"
// Android: "Google"
// Windows: ?
});
```
--------------------------------
### getInstallReferrer
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstallReferrer.html
Retrieves the install referrer information reported by the native platform. This is a getter that returns a Promise resolving to a string.
```APIDOC
## getInstallReferrer
### Description
Retrieves the install referrer information reported by the native platform.
### Method
Getter
### Returns
Promise - A promise that resolves to the install referrer string.
### Example
```
const result = await getInstallReferrer();
```
```
--------------------------------
### Get incremental information with getIncremental
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getIncremental.html
Use this snippet to retrieve the incremental information reported by the native platform. The result is a Promise that resolves to a string. This example is from the getIncremental documentation.
```javascript
const result = await getIncremental();
```
--------------------------------
### Call supportedAbisSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/supportedAbisSync.html
Use this synchronous variant of supportedAbis to get the supported ABIs as an array of strings. The example shows a simple call that returns the result.
```javascript
const result = supportedAbisSync();
```
--------------------------------
### useFirstInstallTime()
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useFirstInstallTime.html
React hook that exposes the app's first install timestamp once it is retrieved. Returns an AsyncHookResult.
```APIDOC
## useFirstInstallTime()
### Description
React hook that exposes the app's first install timestamp once it is retrieved.
### Signature
useFirstInstallTime(): AsyncHookResult
### Returns
AsyncHookResult
### Example
```jsx
function InstallAge() {
const { result } = useFirstInstallTime();
return {new Date(result).toLocaleDateString()};
}
```
```
--------------------------------
### Get Application Name
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the application name.
```javascript
let appName = DeviceInfo.getApplicationName();
// AwesomeApp
```
--------------------------------
### getTags usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getTags.html
Retrieves the tags information reported by the native platform. The example shows awaiting the getTags() call to obtain the result.
```typescript
const result = await getTags();
```
--------------------------------
### getDevice usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getDevice.html
Use this snippet to retrieve device information. The getDevice variable is a getter that returns a Promise resolving to a string. The example shows awaiting the result.
```javascript
const result = await getDevice();
```
--------------------------------
### Usage of getFreeDiskStorageSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getFreeDiskStorageSync.html
This example demonstrates how to call the synchronous getFreeDiskStorageSync method to retrieve the available free disk storage.
```javascript
const result = getFreeDiskStorageSync();
```
--------------------------------
### getSerialNumber() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device serial number. Will be 'unknown' in almost all cases unless you have a privileged app. The example shows a promise resolving to a serial number string.
```javascript
DeviceInfo.getSerialNumber().then((serialNumber) => {
// iOS: unknown
// Android: ? (maybe a serial number, if your app is privileged)
// Windows: ? (a serial number, if your app has the "capability smbios")
});
```
--------------------------------
### isLandscape usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/isLandscape.html
Demonstrates how to call the isLandscape function and await its boolean result.
```javascript
const result = await isLandscape();
```
--------------------------------
### Usage of getInstallerPackageName
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstallerPackageName.html
Retrieves the installer package name information reported by the native platform.
```javascript
const result = await getInstallerPackageName();
```
--------------------------------
### getHostSync() example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getHostSync.html
Synchronous variant of getHost. Returns the host name as a string.
```javascript
const result = getHostSync();
```
--------------------------------
### getMaxMemory() example
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Returns the maximum amount of memory that the VM will attempt to use, in bytes. The example shows a promise resolving to a number.
```javascript
DeviceInfo.getMaxMemory().then((maxMemory) => {
// 402653183
});
```
--------------------------------
### useManufacturer hook example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useManufacturer.html
Use this hook to get the device manufacturer asynchronously. The result is an AsyncHookResult; in the example, the manufacturer is rendered inside a Text component.
```jsx
function ManufacturerLine() {
const { result: manufacturer } = useManufacturer();
return Made by {manufacturer};
}
```
--------------------------------
### Get startup time with getStartupTime
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getStartupTime.html
Use this snippet to retrieve the startup time from the native platform. The result is a Promise that resolves to a number.
```javascript
const result = await getStartupTime();
```
--------------------------------
### useDeviceName hook example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useDeviceName.html
Use this hook to get the device name asynchronously. The result is available in the `result` property of the returned object. The example shows a React component that displays the device name in a `` element.
```javascript
function Greeting() {
const { result: name } = useDeviceName();
return Hello from {name};
}
```
--------------------------------
### getBrand()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device brand.
```APIDOC
## getBrand()
### Description
Gets the device brand.
### Method
GET
### Endpoint
DeviceInfo.getBrand()
### Parameters
None
### Request Example
```
let brand = DeviceInfo.getBrand();
```
### Response
#### Success Response (200)
- **brand** (string) - The device brand.
#### Response Example
```
"Apple"
```
```
--------------------------------
### Using useIsWiredHeadphonesConnected hook
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useIsWiredHeadphonesConnected.html
This example demonstrates how to conditionally render UI elements based on the connection status of wired headphones.
```javascript
function WiredOnlyNotice() {
const { result } = useIsWiredHeadphonesConnected();
return result ? Wired audio active : null;
}
```
--------------------------------
### Example usage of supported64BitAbisSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/supported64BitAbisSync.html
Calls the synchronous getter to retrieve the supported 64-bit ABIs. The result is an array of strings.
```typescript
const result = supported64BitAbisSync();
```
--------------------------------
### useIsEmulator hook usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useIsEmulator.html
Use this hook to check if the app is running on an emulator. The result is available asynchronously; the example renders a Text component when the result is true.
```javascript
function IsEmulatorCallout() {
const { result: emulator } = useIsEmulator();
return emulator ? Running on emulator : null;
}
```
--------------------------------
### getBuildNumber usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getBuildNumber.html
Retrieves the build number from the native platform.
```javascript
const result = getBuildNumber();
```
--------------------------------
### Get Codename
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the current development codename.
```javascript
DeviceInfo.getCodename().then((codename) => {
// "REL"
});
```
--------------------------------
### Get Bootloader Version
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the system bootloader version number.
```javascript
DeviceInfo.getBootloader().then((bootloader) => {
// "mw8998-002.0069.00"
});
```
--------------------------------
### getSecurityPatch usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getSecurityPatch.html
Retrieves the security patch information reported by the native platform.
```javascript
const result = await getSecurityPatch();
```
--------------------------------
### getDisplay usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getDisplay.html
Use this snippet to retrieve the display information from the native platform. The `getDisplay` function returns a Promise that resolves to a string.
```javascript
const result = await getDisplay();
```
--------------------------------
### getVersion() usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getVersion.html
Call getVersion() to retrieve the app version string. The function takes no arguments and returns a string.
```typescript
const result = getVersion();
```
--------------------------------
### Get Device Name
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the device name.
```javascript
DeviceInfo.getDeviceName().then((deviceName) => {
// iOS: "Becca's iPhone 6"
// Android: ?
// Windows: ?
});
```
--------------------------------
### Get Build Number
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the application build number.
```javascript
let buildNumber = DeviceInfo.getBuildNumber();
// iOS: "89"
// Android: "4"
// Windows: ?
```
--------------------------------
### useBatteryLevelIsLow usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useBatteryLevelIsLow.html
Demonstrates how to use the useBatteryLevelIsLow hook to conditionally render a banner when the battery level is low.
```javascript
function LowBatteryBanner() {
const level = useBatteryLevelIsLow();
if (level == null) {
return null;
}
return ;
}
```
--------------------------------
### Retrieve base OS information
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getBaseOs.html
An asynchronous call to get the base OS string from the native platform.
```javascript
const result = await getBaseOs();
```
--------------------------------
### isLandscapeSync usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/isLandscapeSync.html
Synchronously checks the device orientation and returns a boolean value.
```javascript
const result = isLandscapeSync();
```
--------------------------------
### getDeviceName()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device name.
```APIDOC
## getDeviceName()
### Description
Gets the device name.
### Method
GET
### Endpoint
DeviceInfo.getDeviceName()
### Parameters
None
### Request Example
```
DeviceInfo.getDeviceName().then((deviceName) => {
// iOS: "Becca's iPhone 6"
// Android: ?
// Windows: ?
});
```
### Response
#### Success Response (200)
- **deviceName** (string) - The device name.
#### Response Example
```
"Becca's iPhone 6"
```
```
--------------------------------
### Usage of getAvailableLocationProvidersSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getAvailableLocationProvidersSync.html
This example demonstrates how to call the synchronous getAvailableLocationProvidersSync function to retrieve location provider information.
```javascript
const result = getAvailableLocationProvidersSync();
```
--------------------------------
### Usage of getUniqueIdSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getUniqueIdSync.html
This example demonstrates how to call the synchronous getUniqueIdSync function to retrieve the device's unique identifier.
```javascript
const result = getUniqueIdSync();
```
--------------------------------
### Get Battery Level
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the battery level as a float between 0 and 1. Requires battery monitoring to be enabled on iOS.
```javascript
DeviceInfo.getBatteryLevel().then((batteryLevel) => {
// 0.759999
});
```
```objective-c
[UIDevice currentDevice].batteryMonitoringEnabled = true;
```
--------------------------------
### Get Device Brand
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the device brand.
```javascript
let brand = DeviceInfo.getBrand();
// iOS: "Apple"
// Android: "xiaomi"
// Windows: ?
```
--------------------------------
### getManufacturer usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getManufacturer.html
Retrieves the manufacturer information as a promise.
```javascript
const result = await getManufacturer();
```
--------------------------------
### getInstallerPackageNameSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstallerPackageNameSync.html
A synchronous function that returns the installer package name. It is a direct variant of getInstallerPackageName.
```APIDOC
## getInstallerPackageNameSync
### Description
Synchronous variant of getInstallerPackageName.
### Method
Synchronous function
### Endpoint
N/A - SDK function
### Parameters
None
### Request Example
```js
const result = getInstallerPackageNameSync();
```
### Response
#### Success Response
Returns a string (or null) representing the installer package name.
#### Response Example
```js
// Returns a string or undefined
```
```
--------------------------------
### getManufacturer()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device manufacturer.
```APIDOC
## getManufacturer()
### Description
Gets the device manufacturer.
### Method
GET
### Endpoint
DeviceInfo.getManufacturer()
### Parameters
None
### Request Example
```
DeviceInfo.getManufacturer().then((manufacturer) => {
// iOS: "Apple"
// Android: "Google"
// Windows: ?
});
```
### Response
#### Success Response
- **manufacturer** (string) - The device manufacturer.
#### Response Example
```
// iOS: "Apple"
// Android: "Google"
// Windows: ?
```
```
--------------------------------
### Get supported 64-bit ABIs
Source: https://react-native-device-info.github.io/react-native-device-info/variables/supported64BitAbis.html
Retrieves the list of supported 64-bit ABIs from the native platform. The result is a Promise that resolves to an array of strings.
```javascript
const result = await supported64BitAbis();
```
--------------------------------
### getApplicationName usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getApplicationName.html
Call getApplicationName() to retrieve the application name as a string. The function returns a string value.
```javascript
const result = getApplicationName();
```
--------------------------------
### Get Device Name
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the name of the industrial design.
```javascript
DeviceInfo.getDevice().then((device) => {
// "walleye"
});
```
--------------------------------
### getDeviceToken usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getDeviceToken.html
Retrieves the native APNS device token as a promise.
```javascript
const result = await getDeviceToken();
```
--------------------------------
### Usage of getUsedMemorySync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getUsedMemorySync.html
This example demonstrates how to call the synchronous getUsedMemorySync function to retrieve the current memory usage.
```javascript
const result = getUsedMemorySync();
```
--------------------------------
### Get Bundle ID
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the application bundle identifier.
```javascript
let bundleId = DeviceInfo.getBundleId();
// "com.example.AwesomeApp"
```
--------------------------------
### getBaseOs()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
The base OS build the product is based on.
```APIDOC
## getBaseOs()
### Description
The base OS build the product is based on.
### Method
GET
### Endpoint
DeviceInfo.getBaseOs()
### Parameters
None
### Request Example
```
DeviceInfo.getBaseOs().then((baseOs) => {
// "Windows", "Android" etc
});
```
### Response
#### Success Response (200)
- **baseOs** (string) - The base OS build the product is based on.
#### Response Example
```
"Android"
```
```
--------------------------------
### getTotalMemory usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getTotalMemory.html
Use this snippet to retrieve the total memory information from the native platform. The result is a Promise that resolves to a number.
```javascript
const result = await getTotalMemory();
```
--------------------------------
### getMacAddress()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the network adapter MAC address.
```APIDOC
## getMacAddress()
### Description
Gets the network adapter MAC address.
### Method
GET
### Endpoint
DeviceInfo.getMacAddress()
### Parameters
None
### Request Example
```
DeviceInfo.getMacAddress().then((mac) => {
// "E5:12:D8:E5:69:97"
});
```
### Response
#### Success Response
- **mac** (string) - The network adapter MAC address.
#### Response Example
```
// "E5:12:D8:E5:69:97"
```
```
--------------------------------
### getCarrier usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getCarrier.html
Use this snippet to retrieve the carrier information. The result is a Promise that resolves to a string.
```javascript
const result = await getCarrier();
```
--------------------------------
### isTablet usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/isTablet.html
Calls isTablet() and assigns the result to a constant. The function returns a boolean indicating whether the device is a tablet.
```javascript
const result = isTablet();
```
--------------------------------
### getFreeDiskStorageOld()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Legacy implementation for getting available storage size in bytes.
```javascript
DeviceInfo.getFreeDiskStorageOld().then((freeDiskStorage) => {
// Android: 17179869184
// iOS: 17179869184
});
```
--------------------------------
### usePowerState Usage Example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/usePowerState.html
A basic implementation of the usePowerState hook to display the current battery state in a React Native component.
```javascript
function ChargingStatus() {
const powerState = usePowerState();
return {powerState.batteryState};
}
```
--------------------------------
### getDeviceType usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getDeviceType.html
Basic usage of the getDeviceType function to retrieve the device type string.
```javascript
const result = getDeviceType();
```
--------------------------------
### getDeviceId usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getDeviceId.html
Retrieves the device ID information reported by the native platform.
```javascript
const result = getDeviceId();
```
--------------------------------
### getBrightness usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getBrightness.html
Retrieves the current brightness level as a number. The result is a Promise that resolves to the brightness value reported by the native platform.
```javascript
const result = await getBrightness();
```
--------------------------------
### getModel()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device model. **iOS warning:** The list with device names is maintained by the community and could lag new devices. It is recommended to use `getDeviceId()` since it's more reliable and always up-to-date with new iOS devices. We do accept pull requests that add new iOS devices to the list with device names.
```APIDOC
## getModel()
### Description
Gets the device model. **iOS warning:** The list with device names is maintained by the community and could lag new devices. It is recommended to use `getDeviceId()` since it's more reliable and always up-to-date with new iOS devices. We do accept pull requests that add new iOS devices to the list with device names.
### Method
GET
### Endpoint
DeviceInfo.getModel()
### Parameters
None
### Request Example
```
let model = DeviceInfo.getModel();
// iOS: ?
// Android: ?
// Windows: ?
```
### Response
#### Success Response
- **model** (string) - The device model.
#### Response Example
```
// iOS: ?
// Android: ?
// Windows: ?
```
```
--------------------------------
### Get Device ID
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the device ID.
```javascript
let deviceId = DeviceInfo.getDeviceId();
// iOS: "iPhone7,2"
// Android: "goldfish"
// Windows: "Y3R94UC#AC4"
```
--------------------------------
### getCarrier()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the carrier name (network operator).
```APIDOC
## getCarrier()
### Description
Gets the carrier name (network operator).
### Method
GET
### Endpoint
DeviceInfo.getCarrier()
### Parameters
None
### Request Example
```
DeviceInfo.getCarrier().then((carrier) => {
// "SOFTBANK"
});
```
### Response
#### Success Response (200)
- **carrier** (string) - The carrier name.
#### Response Example
```
"SOFTBANK"
```
```
--------------------------------
### getAppSetId() example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getAppSetId.html
Retrieves the app set ID information reported by the native platform. The returned promise resolves to an object containing the app set ID and its scope.
```javascript
const result = await getAppSetId();
```
--------------------------------
### hasHmsSync usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/hasHmsSync.html
Calls the hasHmsSync() getter to synchronously check if the device supports HMS. The result is a boolean.
```javascript
const result = hasHmsSync();
```
--------------------------------
### isLowBatteryLevel usage
Source: https://react-native-device-info.github.io/react-native-device-info/functions/isLowBatteryLevel.html
Example showing how to use isLowBatteryLevel to check if a battery level is considered low.
```javascript
const isLow = isLowBatteryLevel(0.12);
```
--------------------------------
### useBrightness hook example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useBrightness.html
Subscribes to screen brightness updates and renders a disabled Slider with the current brightness value, defaulting to 0 when null.
```javascript
function BrightnessSlider() {
const brightness = useBrightness();
return ;
}
```
--------------------------------
### getReadableVersion usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getReadableVersion.html
Call getReadableVersion to retrieve the readable version string. The function returns a string value.
```javascript
const result = getReadableVersion();
```
--------------------------------
### Usage of isBluetoothHeadphonesConnectedSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/isBluetoothHeadphonesConnectedSync.html
A basic example showing how to call the synchronous isBluetoothHeadphonesConnectedSync function to retrieve the connection status.
```javascript
const result = isBluetoothHeadphonesConnectedSync();
```
--------------------------------
### Get supported media type list
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getSupportedMediaTypeList.html
Retrieves the supported media type list from the native platform. The result is a Promise that resolves to an array of strings.
```javascript
const result = await getSupportedMediaTypeList();
```
--------------------------------
### getLastUpdateTime()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the time at which the app was last updated, in milliseconds.
```APIDOC
## getLastUpdateTime()
### Description
Gets the time at which the app was last updated, in milliseconds.
### Method
GET
### Endpoint
DeviceInfo.getLastUpdateTime()
### Parameters
None
### Request Example
```
DeviceInfo.getLastUpdateTime().then((lastUpdateTime) => {
// Android: 1517681764992
});
```
### Response
#### Success Response
- **lastUpdateTime** (number) - The time at which the app was last updated, in milliseconds.
#### Response Example
```
// Android: 1517681764992
```
```
--------------------------------
### useBatteryLevel usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useBatteryLevel.html
Displays the current battery level in a React component, defaulting to 'unknown' if the level is null.
```javascript
function BatteryIndicator() {
const level = useBatteryLevel();
return {level ?? 'unknown'}%;
}
```
--------------------------------
### Call getStartupTimeSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getStartupTimeSync.html
Retrieves the startup time synchronously. This is the synchronous variant of getStartupTime.
```javascript
const result = getStartupTimeSync();
```
--------------------------------
### getType usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getType.html
Retrieves the device type asynchronously. The result is a string representing the type reported by the native platform.
```typescript
const result = await getType();
```
--------------------------------
### Get Display ID
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves a build ID string for display purposes.
```javascript
DeviceInfo.getDisplay().then((display) => {
// "OPM2.171026.006.G1"
});
```
--------------------------------
### Get Carrier Name
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the carrier name (network operator).
```javascript
DeviceInfo.getCarrier().then((carrier) => {
// "SOFTBANK"
});
```
--------------------------------
### getDisplaySync usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getDisplaySync.html
Calls getDisplaySync() to retrieve the display information synchronously. The result is stored in a constant named result.
```typescript
const result = getDisplaySync();
```
--------------------------------
### Get API Level
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the Android API level of the device.
```javascript
DeviceInfo.getApiLevel().then((apiLevel) => {
// iOS: ?
// Android: 25
// Windows: ?
});
```
--------------------------------
### getFontScale usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getFontScale.html
Use this snippet to retrieve the font scale value. It awaits the getter and stores the result in a constant.
```javascript
const result = await getFontScale();
```
--------------------------------
### getBatteryLevel()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the battery level of the device as a float comprised between 0 and 1.
```APIDOC
## getBatteryLevel()
### Description
Gets the battery level of the device as a float comprised between 0 and 1.
### Method
GET
### Endpoint
DeviceInfo.getBatteryLevel()
### Parameters
None
### Request Example
```
DeviceInfo.getBatteryLevel().then((batteryLevel) => {
// 0.759999
});
```
### Response
#### Success Response (200)
- **batteryLevel** (number) - The battery level as a float between 0 and 1.
#### Response Example
```
0.759999
```
```
--------------------------------
### Get API Level
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getApiLevel.html
Retrieves the API level information reported by the native platform.
```javascript
const result = await getApiLevel();
```
--------------------------------
### useHasSystemFeature hook example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/useHasSystemFeature.html
Use this hook to check for the Android system feature 'android.hardware.biometrics.face' and conditionally render a message based on the result. The hook returns an AsyncHookResult where the result is true if the feature is supported. The example shows a React component that displays 'Face unlock supported' or 'Face unlock unavailable' accordingly.
```javascript
function FaceUnlockOnly() {
const { result } = useHasSystemFeature('android.hardware.biometrics.face');
return {result ? 'Face unlock supported' : 'Face unlock unavailable'};
}
```
--------------------------------
### getStartupTimeSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getStartupTimeSync.html
Synchronous variant of getStartupTime. Returns the startup time as a number.
```APIDOC
## getStartupTimeSync
### Description
Synchronous variant of getStartupTime. Returns the startup time as a number.
### Method
Synchronous getter
### Endpoint
N/A (SDK function)
### Parameters
None
### Request Example
```
const result = getStartupTimeSync();
```
### Response
#### Success Response
- **result** (number) - The startup time value.
#### Response Example
```
const result = getStartupTimeSync();
```
```
--------------------------------
### getInstanceId()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the application instance ID. This attempts to get an instance ID from these sources, in this order: a value under key `instanceId` in SharedPreferences file `react-native-device-info`, Firebase IID (if `firebaseBomVersion` or `firebaseIidVersion` is defined in gradle ext - **deprecated**), GMS IID (if `googlePlayServicesIidVersion` or `googlePlayServicesVersion` is defined in gradle ext - **deprecated**), a random UUID generated from java.util.UUID.randomUUID() and stored in SharedPreferences.
```APIDOC
## getInstanceId()
### Description
Gets the application instance ID. This attempts to get an instance ID from these sources, in this order: a value under key `instanceId` in SharedPreferences file `react-native-device-info`, Firebase IID (if `firebaseBomVersion` or `firebaseIidVersion` is defined in gradle ext - **deprecated**), GMS IID (if `googlePlayServicesIidVersion` or `googlePlayServicesVersion` is defined in gradle ext - **deprecated**), a random UUID generated from java.util.UUID.randomUUID() and stored in SharedPreferences.
### Method
GET
### Endpoint
DeviceInfo.getInstanceId()
### Parameters
None
### Request Example
```
DeviceInfo.getInstanceId().then((instanceId) => {
// Android: da4e0245-5d6c-402a-a07c-0c5349f229e2
});
```
### Response
#### Success Response
- **instanceId** (string) - The application instance ID.
#### Response Example
```
// Android: da4e0245-5d6c-402a-a07c-0c5349f229e2
```
```
--------------------------------
### Get free disk storage with getFreeDiskStorage
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getFreeDiskStorage.html
Use this snippet to retrieve the free disk storage information reported by the native platform. The result is a Promise that resolves to a number representing the free disk storage in bytes.
```javascript
const result = await getFreeDiskStorage();
```
--------------------------------
### getFreeDiskStorageOld usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getFreeDiskStorageOld.html
Calls getFreeDiskStorageOld() and awaits the result. The function returns a Promise representing the free disk storage in bytes. This is a backwards-compatible wrapper for the legacy Android calculation.
```javascript
const result = await getFreeDiskStorageOld();
```
--------------------------------
### Get supported ABIs
Source: https://react-native-device-info.github.io/react-native-device-info/variables/supportedAbis.html
Use the supportedAbis function to retrieve a list of supported ABIs from the native platform as a promise.
```javascript
const result = await supportedAbis();
```
--------------------------------
### Retrieve device name
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getDeviceName.html
An asynchronous call to get the device name from the native platform.
```javascript
const result = await getDeviceName();
```
--------------------------------
### getSecurityPatchSync() example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getSecurityPatchSync.html
Use this synchronous variant of getSecurityPatch to retrieve the security patch level as a string. The call blocks until the value is available, so it is suitable for contexts where asynchronous operations are not possible.
```javascript
const result = getSecurityPatchSync();
```
--------------------------------
### isWiredHeadphonesConnectedSync usage example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/isWiredHeadphonesConnectedSync.html
Calls the synchronous getter to check if wired headphones are connected. The result is a boolean value.
```typescript
const result = isWiredHeadphonesConnectedSync();
```
--------------------------------
### getFontScale()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets the device font scale ratio, useful for handling accessibility settings.
```javascript
DeviceInfo.getFontScale().then((fontScale) => {
// 1.2
});
```
--------------------------------
### getSystemVersion()
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getSystemVersion.html
Retrieves the system version information reported by the native platform. Returns a string representing the system version.
```APIDOC
## getSystemVersion()
### Description
Retrieves the system version information reported by the native platform.
### Method
getSystemVersion()
### Returns
- **string** - The system version information.
### Example
```
const result = getSystemVersion();
```
```
--------------------------------
### Get instance ID with getInstanceId
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getInstanceId.html
Use this snippet to retrieve the instance ID from the native platform. The result is a Promise that resolves to a string.
```javascript
const result = await getInstanceId();
```
--------------------------------
### Call syncUniqueId with await
Source: https://react-native-device-info.github.io/react-native-device-info/functions/syncUniqueId.html
Use this example to call syncUniqueId and await its result. The function returns a Promise and preloads the unique ID on iOS for later synchronous access via getUniqueId.
```javascript
const result = await syncUniqueId();
```
--------------------------------
### isKeyboardConnectedSync getter example
Source: https://react-native-device-info.github.io/react-native-device-info/variables/isKeyboardConnectedSync.html
Use this synchronous getter to check if a keyboard is connected. It returns a boolean value. This is the synchronous variant of the asynchronous isKeyboardConnected method.
```javascript
const result = isKeyboardConnectedSync();
```
--------------------------------
### Usage of getTotalDiskCapacityOld
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getTotalDiskCapacityOld.html
Demonstrates how to call the asynchronous getTotalDiskCapacityOld function to retrieve the legacy total disk capacity.
```javascript
const result = await getTotalDiskCapacityOld();
```
--------------------------------
### getIpAddress()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Deprecated method to get the current Wi-Fi IP address. Use react-native-netinfo instead.
```javascript
DeviceInfo.getIpAddress().then((ip) => {
// "92.168.32.44"
});
```
--------------------------------
### getProduct()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
The name of the overall product.
```APIDOC
## getProduct()
### Description
The name of the overall product.
### Method
GET
### Endpoint
DeviceInfo.getProduct()
### Parameters
None
### Request Example
```
DeviceInfo.getProduct().then((product) => {
// "walleye"
});
```
### Response
#### Success Response
- **product** (string) - The name of the overall product.
#### Response Example
```
// "walleye"
```
```
--------------------------------
### getBundleId() usage example
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getBundleId.html
Calls getBundleId() and stores the returned string bundle ID in a constant. The function reflects the native platform's bundle identifier.
```javascript
const result = getBundleId();
```
--------------------------------
### Get IP Address with getIpAddress
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getIpAddress.html
Use this snippet to retrieve the device's IP address as reported by the native platform. The getIpAddress getter returns a Promise that resolves to a string. Await the promise to obtain the IP address value.
```javascript
const result = await getIpAddress();
```
--------------------------------
### getFreeDiskStorage()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Gets available storage size in bytes. iOS supports optional arguments for specific capacity keys.
```javascript
DeviceInfo.getFreeDiskStorage().then((freeDiskStorage) => {
// Android: 17179869184
// iOS: 17179869184
});
DeviceInfo.getFreeDiskStorage('important').then((freeDiskStorage) => {
// iOS: 18198219342 (important storage)
});
```
--------------------------------
### getHost()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Hostname
```APIDOC
## getHost()
### Description
Hostname
### Method
N/A (SDK method)
### Endpoint
DeviceInfo.getHost()
### Parameters
None
### Request Example
```
DeviceInfo.getHost().then((host) => {
// "wprd10.hot.corp.google.com"
});
```
### Response
#### Success Response
- **host** (string) - The hostname.
#### Response Example
```
// "wprd10.hot.corp.google.com"
```
```
--------------------------------
### Call isPinOrFingerprintSetSync
Source: https://react-native-device-info.github.io/react-native-device-info/variables/isPinOrFingerprintSetSync.html
Use this synchronous variant to check if a PIN or fingerprint is set. The example shows a simple call that returns a boolean.
```javascript
const result = isPinOrFingerprintSetSync();
```
--------------------------------
### getHardware()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
The name of the hardware (from the kernel command line or /proc).
```APIDOC
## getHardware()
### Description
The name of the hardware (from the kernel command line or /proc).
### Method
N/A (SDK method)
### Endpoint
DeviceInfo.getHardware()
### Parameters
None
### Request Example
```
DeviceInfo.getHardware().then(hardware => {
// "walleye"
});
```
### Response
#### Success Response
- **hardware** (string) - The name of the hardware.
#### Response Example
```
// "walleye"
```
```
--------------------------------
### supported64BitAbis
Source: https://react-native-device-info.github.io/react-native-device-info/variables/supported64BitAbis.html
Documentation for the supported64BitAbis getter variable.
```APIDOC
## supported64BitAbis
### Description
Lists the supported 64 bit ABIs reported by the native platform.
### Method
Getter (async function)
### Returns
- **Promise** - A promise that resolves to an array of strings representing the supported 64-bit ABIs.
### Example
```js
const result = await supported64BitAbis();
```
```
--------------------------------
### Retrieve product information with getProduct
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getProduct.html
Retrieves the product information reported by the native platform using an asynchronous call.
```javascript
const result = await getProduct();
```
--------------------------------
### Call getApiLevelSync()
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getApiLevelSync.html
Use this synchronous variant to retrieve the Android API level as a number. The example shows a simple call that returns the API level.
```javascript
const result = getApiLevelSync();
```
--------------------------------
### Get battery level with getBatteryLevel()
Source: https://react-native-device-info.github.io/react-native-device-info/variables/getBatteryLevel.html
Use this snippet to retrieve the current battery level as a Promise that resolves to a number. The result is obtained from the native platform and can be awaited in an async function.
```javascript
const result = await getBatteryLevel();
Copy
```
--------------------------------
### Get WiFi MAC Address
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getMacAddress.html
Retrieves the WiFi MAC address as a promise. Returns a constant placeholder on non-Android platforms.
```javascript
const result = await getMacAddress();
```
--------------------------------
### Get App Set ID
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the App Set ID for Android devices. Requires setting playServicesAppSetVersion in android/build.gradle.
```javascript
DeviceInfo.getAppSetId().then((appSetIdInfo) => {
if (appSetIdInfo.id === 'unknown') {
console.log('AppSetId not available on this device');
} else {
console.log('AppSetId:', appSetIdInfo.id);
console.log('Scope:', appSetIdInfo.scope); // 1 for app-scoped, 2 for developer-scoped
}
});
// Synchronous version
const appSetIdInfo = DeviceInfo.getAppSetIdSync();
if (appSetIdInfo.id === 'unknown') {
console.log('AppSetId not available on this device');
} else {
console.log('AppSetId:', appSetIdInfo.id);
console.log('Scope:', appSetIdInfo.scope);
}
```
--------------------------------
### Get Android ID
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Retrieves the ANDROID_ID of the device. Consult official Android API documentation for appropriate use cases.
```javascript
DeviceInfo.getAndroidId().then((androidId) => {
// androidId here
});
```
--------------------------------
### getSystemName()
Source: https://react-native-device-info.github.io/react-native-device-info/functions/getSystemName.html
Retrieves the system name information reported by the native platform. Returns a string.
```APIDOC
## getSystemName()
### Description
Retrieves the system name information reported by the native platform.
### Method
Function
### Signature
`getSystemName(): string`
### Returns
- **string** - The system name information.
### Example
```
const result = getSystemName();
```
```
--------------------------------
### Call isCameraPresentSync to check camera presence
Source: https://react-native-device-info.github.io/react-native-device-info/variables/isCameraPresentSync.html
Use this synchronous getter to check if a camera is present on the device. It returns a boolean value. This example shows a simple call to isCameraPresentSync().
```javascript
const result = isCameraPresentSync();
```
--------------------------------
### getBootloader()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
The system bootloader version number.
```APIDOC
## getBootloader()
### Description
The system bootloader version number.
### Method
GET
### Endpoint
DeviceInfo.getBootloader()
### Parameters
None
### Request Example
```
DeviceInfo.getBootloader().then((bootloader) => {
// "mw8998-002.0069.00"
});
```
### Response
#### Success Response (200)
- **bootloader** (string) - The system bootloader version number.
#### Response Example
```
"mw8998-002.0069.00"
```
```
--------------------------------
### getFreeDiskStorage()
Source: https://react-native-device-info.github.io/react-native-device-info/index.html
Method that gets available storage size, in bytes, taking into account both root and data file systems calculation. On iOS, this method accepts optional arguments to specify the type of storage capacity.
```APIDOC
## getFreeDiskStorage()
### Description
Method that gets available storage size, in bytes, taking into account both root and data file systems calculation.
On **iOS** , this method accepts the following optional arguments:
* `'total'`: Uses `volumeAvailableCapacityKey`
* `'important'`: Uses `volumeAvailableCapacityForImportantUsageKey`
* `'opportunistic'`: Uses `volumeAvailableCapacityForOpportunisticUsageKey`
For more details, refer to Apple Documentation on Checking Volume Storage Capacity.
### Method
N/A (SDK method)
### Endpoint
DeviceInfo.getFreeDiskStorage()
### Parameters
#### Optional Parameters
- **type** (string) - Optional - On iOS, can be 'total', 'important', or 'opportunistic' to specify the type of storage capacity to query.
### Request Example
```
DeviceInfo.getFreeDiskStorage().then((freeDiskStorage) => {
// Android: 17179869184
// iOS: 17179869184
});
DeviceInfo.getFreeDiskStorage('important').then((freeDiskStorage) => {
// iOS: 18198219342 (important storage)
});
```
### Response
#### Success Response
- **freeDiskStorage** (number) - The available storage size in bytes.
#### Response Example
```
// Android: 17179869184
// iOS: 17179869184
```
```