React Native SDK (Android)
Package: teleneura-react-native
Thin bridge from JavaScript to the native com.teleneura.sdk:shared artifact. Batch accumulation, device metadata, and HTTPS ingestion run entirely on the native side — TypeScript only passes primitives (initialize, reportInference, flush).
Prerequisites
- Android-only today — iOS would require a separate native implementation.
- Maven Local: publish the Teleneura
sharedmodule frompackages/teleneura-sdk-KMP:cd packages/teleneura-sdk-KMP && ./gradlew :shared:publishToMavenLocal - Repositories: the React Native app’s Android Gradle config must include
mavenLocal()alongsidegoogle()andmavenCentral(). - Kotlin:
sharedis published with Kotlin 2.3.x. Align your host app’s Kotlin Gradle plugin (e.g.kotlinVersion = "2.3.0"). Older Kotlin toolchains cannot read newer library metadata.
Installation
From your application repo:
npm install /absolute/or/relative/path/to/packages/teleneura-rn-bridge
peerDependencies: React ≥ 18, React Native ≥ 0.74.
Autolinking is configured via react-native.config.js (TeleneuraPackage). After install:
cd android && ./gradlew clean && cd ..
npx react-native run-android
Manual link (only if autolinking is disabled): add TeleneuraPackage() alongside your other packages in MainApplication / ReactNativeHost getPackages().
import com.teleneura.rn.bridge.TeleneuraPackage
// Inside getPackages():
packages.add(TeleneuraPackage())
Usage
import { Teleneura } from 'teleneura-react-native'
await Teleneura.init({
apiKey: process.env.TELENEURA_API_KEY!,
baseUrl: 'https://api.example.com',
batchSize: 32,
enableDebugLogs: __DEV__,
})
// Fire-and-forget path — lowest bridge overhead per inference
Teleneura.reportInference('model-name', latencyMs)
// e.g. AppState → background
await Teleneura.flush()
The native module registers as TeleneuraReactNativeModule (NativeModules.TeleneuraReactNativeModule).
API
Method | Description |
|---|---|
init(config) |
|
reportInference(modelName, latencyMs) | Synchronous JS call; batches on native threads. |
flush() | Sends buffered batches immediately. |
Errors surface as promise rejections from init / flush with codes such as E_CONFIG, E_INIT, E_FLUSH.
Troubleshooting
Symptom | Check |
|---|---|
| Native module not found | Rebuild Android after |
Gradle cannot resolve shared | Run |
Kotlin metadata / incompatible version | Upgrade host Kotlin to 2.3.x (or publish |