Adapters
Platform adapters for storage, device info, and notifications.
The Teardown SDK uses adapters to abstract platform-specific functionality. This allows the SDK to work across different React Native environments (Expo, bare RN) and with different underlying libraries.
Adapter Types
Device Adapters
Collect device and application information for identification and analytics.
| Adapter | Package | Use Case |
|---|---|---|
ExpoDeviceAdapter | expo-device, expo-application | Expo projects |
DeviceInfoAdapter | react-native-device-info | Bare RN projects |
BasicAdapter | None | Fallback/testing |
Storage Adapters
Handle persistent data storage for sessions, device IDs, and version status.
| Adapter | Package | Use Case |
|---|---|---|
MMKVStorageAdapter | react-native-mmkv | Fast sync storage (recommended) |
AsyncStorageAdapter | @react-native-async-storage/async-storage | Broader compatibility |
Notification Adapters
Handle push notification registration and token management.
| Adapter | Package | Use Case |
|---|---|---|
ExpoNotificationsAdapter | expo-notifications | Expo projects |
FirebaseMessagingAdapter | @react-native-firebase/messaging | Firebase Cloud Messaging |
WixNotificationsAdapter | react-native-notifications | Wix notifications library |
Required Adapters
When initializing TeardownCore, you must provide:
const teardown = new TeardownCore({
org_id: 'your-org-id',
project_id: 'your-project-id',
api_key: 'your-api-key',
storageAdapter: new MMKVStorageAdapter(), // Required
deviceAdapter: new ExpoDeviceAdapter(), // Required
});Common Configurations
Expo Project
import { TeardownCore } from '@teardown/force-updates';
import { ExpoDeviceAdapter } from '@teardown/force-updates/adapters/expo';
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 ExpoDeviceAdapter(),
});Bare React Native Project
import { TeardownCore } from '@teardown/force-updates';
import { DeviceInfoAdapter } from '@teardown/force-updates/adapters/device-info';
import { AsyncStorageAdapter } from '@teardown/force-updates/adapters/async-storage';
export const teardown = new TeardownCore({
org_id: 'your-org-id',
project_id: 'your-project-id',
api_key: 'your-api-key',
storageAdapter: new AsyncStorageAdapter(),
deviceAdapter: new DeviceInfoAdapter(),
});Custom Adapters
All adapter types can be extended for custom implementations. See individual adapter sections for interface definitions.