Initialization
In a bare React Native project, alphyn-cli integrate adds this call to your JavaScript entry
point (index.js, or index.ts/.tsx), bounded by alphyn:rninit markers, so you can read and
adjust it. A managed Expo project is wired through the config plugin instead (it has no root JS
entry, and the plugin starts the SDK at launch on both platforms), so this call is not added there;
see Expo.
Initialize as early as possible, before rendering your app:
import { AlphynSDK } from '@alphyn/react-native-sdk';
await AlphynSDK.initialize({ scanInterval: 45, androidDebugHash: __DEV__ ? 'YOUR_ANDROID_DEBUG_HASH' : undefined, iosDebugHash: __DEV__ ? 'YOUR_IOS_DEBUG_HASH' : undefined,});Initialization notes:
scanIntervalis expressed in seconds.scanIntervalmust be greater than8.initialize()is idempotent: a repeated call resolves at once when the SDK is already starting or started, and never starts a second scanner.- On iOS the SDK also starts at launch, from the
AppDelegate(the launcherintegrateinstalls). That is not a conflict: the launch init and this JavaScript call share one gate, so whichever runs first starts the SDK once and the other is a safe no-op. See Platform Setup.
Debug Hash
Section titled “Debug Hash”A React Native project registers as two separate apps on the portal, one per platform, each with its own hashes. There is no single shared debug hash, which is why the two hashes are separate options:
androidDebugHashis applied only when running on Android.iosDebugHashis applied only when running on iOS.
There is no debugHash option. Passing one has no effect.
When to use each:
- iOS: normally required for development. An iOS app’s hash changes on every build and only archives register, so debug and simulator builds cannot initialize the SDK without a pinned hash.
- Android: normally not needed. The Gradle hook registers every Android build. Pin one only for the deliberate cases: a build environment without the hook, or pinning one specific registered build.
Both values come from the dashboard, under App Details, on each platform’s own app.
Prefer passing them to the CLI rather than editing the file, so they are recorded in
alphyn.json and survive a re-integrate:
alphyn-cli integrate \ --android-api-key <ANDROID_APP_KEY> \ --ios-api-key <IOS_APP_KEY> \ --ios-debug-hash <64-HEX>