# React Native

Install the React Native source SDK for Aplyna's iOS billing pilot, purchase restoration and verified entitlements, plus iOS/Android events and configuration.

## Install the package

Package: @aplyna/react-native · version 1.0.1. Import the default Aplyna export from @aplyna/react-native.

> **Preview distribution**
> Published on npm. Requires React Native's new architecture, iOS 16+ or Android 24+. It does not work inside Expo Go. Build the native app locally with Xcode/Gradle.

- [Download React Native SDK](https://aplyna.com/downloads/aplyna-react-native.zip): Includes TypeScript, native adapters and their shared Swift/Kotlin source.

1. Install @aplyna/react-native with npm or yarn.
2. Run your app's existing iOS pod-install workflow and rebuild the native application.

### Install

```
npm install @aplyna/react-native
cd ios
bundle exec pod install
```

## Send an event

### TypeScript

```
import Aplyna from '@aplyna/react-native';

const installationId = await Aplyna.configure({ apiKey: 'YOUR_APP_SDK_KEY' });
// Only after your application permits tracking:
await Aplyna.setConsent(true);
await Aplyna.track('app_opened');
await Aplyna.flush();
```

configure returns a persisted anonymous installation ID and starts with consent disabled. Supply your existing installationId when adopting an existing integration. Catch rejected promises and retry flush later after final delivery failures.

## Shared methods

The adapter exposes setConsent, track, flush, pendingEventCount, assignment, expose and configuration. Track options include flowId, stepId, assignment and string-valued properties. Fetching an assignment does not expose it: call expose when the assigned UI is actually visible. iOS configuration supports schemas 1/2; Android supports schema 1. Keep bundled fallback UI.

> **Code-first integration**
> Your application renders its own screens. Aplyna.billing is the separately configured iOS purchase/restore/entitlement pilot. Physical Sandbox lifecycle checks and internal TestFlight startup have been recorded; they do not establish general production, Android purchase or cross-device migration support. A separate Android implementation remains unreleased under device validation. SDK trial events do not verify payments.

- [Add subscription billing](https://aplyna.com/docs/billing-quickstart): Configure the iOS pilot and use purchase, restore and verified entitlement APIs.
- [Inspect delivery](https://aplyna.com/docs/events): Select the same app and open Customers for installation activity.
