@zerogpu/expo-android-sdk
v0.0.4
Published
Expo/React Native module that runs a ZeroGPU on-device inference node on Android by wrapping the native ai.zerogpu:android-sdk AAR.
Readme
@zerogpu/expo-android-sdk
Expo / React Native module that turns an Android device into an on-device
inference node on the ZeroGPU network. It wraps the native
ai.zerogpu:android-sdk AAR and exposes a tiny JS API.
Android-only. iOS builds link a no-op stub so cross-platform apps still compile, but the device only acts as a node on Android. The native library ships
arm64-v8a(phones) andx86_64(emulators) only.
Install
npx expo install @zerogpu/expo-android-sdkAdd the config plugin to app.json / app.config.js:
{
"expo": {
"plugins": ["@zerogpu/expo-android-sdk"]
}
}Then regenerate the native project:
npx expo prebuildThe plugin wires up the two app-level Android needs automatically:
- a
pickFirst '**/libc++_shared.so'packaging rule (the AAR bundles native libs from ONNX Runtime and llama.cpp, both of which shiplibc++_shared.so), and - raises
minSdkVersionto 26 if your app is lower (never lowers it).
Permissions (INTERNET, ACCESS_NETWORK_STATE) and largeHeap come from the AAR
manifest and merge in automatically — nothing to add.
Requires an Expo app using
expo-modules-core(managed or bare). This is not a plain-React-Native library.
Usage
import { start, stop } from '@zerogpu/expo-android-sdk';
// Start the node (typically once, e.g. in your root component / on app launch).
await start('zgpu-sdk-xxxxxxxx'); // your operator key from https://zerogpu.ai
// ...later, on teardown:
await stop();Keep the operator key out of source control (e.g. via expo-constants /
environment config), just like any secret.
start() is idempotent, and the native SDK manages the foreground/background socket
itself — you do not need to wire it to AppState. On iOS both calls resolve as
no-ops.
Options
await start('zgpu-sdk-…', {
baseUrl: 'https://devices.zerogpu.ai', // default
env: 'production', // default
enableTelemetry: true, // default
});Verifying it works
Run the app on an arm64-v8a phone or an x86_64 emulator (Android 8.0+), then
watch logcat:
adb logcat -s ZeroGpuSdk:* ZeroGpuWebSocket:*You want to see status":"idle" and WebSocket ready for tasks. Send an inference
request to https://api.zerogpu.ai/v1/chat/completions with your API key and
match the response id to the requestId in logcat — see the SDK's
INTEGRATION.md for the full end-to-end check.
Versioning
This package is published from the same release as the AAR and always carries the
same version as ai.zerogpu:android-sdk. The AAR coordinate is derived from this
package's own package.json, so an installed npm version always pulls the matching
AAR.
License
Apache-2.0
