Teardown

DeviceInfoAdapter

Device adapter for bare React Native projects using react-native-device-info.

The DeviceInfoAdapter uses react-native-device-info to collect device information in bare React Native projects.

Installation

npm install react-native-device-info
# or
bun add react-native-device-info

For iOS, run pod install:

cd ios && pod install

Usage

import { TeardownCore } from '@teardown/force-updates';
import { DeviceInfoAdapter } from '@teardown/force-updates/adapters/device-info';
import { MMKVStorageAdapter } from '@teardown/force-updates/adapters/mmkv';

export const teardown = new TeardownCore({
  org_id: 'your-org-id',
  project_id: 'your-project-id',
  api_key: 'your-api-key',
  storageAdapter: new MMKVStorageAdapter(),
  deviceAdapter: new DeviceInfoAdapter(),
});

Import Path

import { DeviceInfoAdapter } from '@teardown/force-updates/adapters/device-info';

Collected Data

Application Info

  • version - From getVersion()
  • build_number - From getBuildNumber() (as number)

Hardware Info

  • device_name - From getDeviceName()
  • device_brand - From getBrand()
  • device_type - From getDeviceType() (phone, tablet, desktop, tv, unknown)

OS Info

  • platform - Mapped from React Native Platform.OS to DevicePlatformEnum
  • name - From getSystemName()
  • version - From getSystemVersion()

When to Use

  • Bare React Native CLI projects
  • Projects not using Expo modules
  • Projects requiring additional device info beyond what Expo provides

Requirements

  • react-native-device-info >= 15.0.0
  • React Native >= 0.60 (autolinking)

Platform Notes

iOS

Requires pod install after installation.

Android

Works out of the box with autolinking.