Skip to content

Installation

There are three ways to add the SDK. Pick one, then set the build settings below.

  • Option 1, the Alphyn CLI: one command vendors the plugin and wires the Android registry. Recommended.
  • Option 2, from the registry by hand: add the package through the Unity Package Manager; the Android AAR resolves from the registry.
  • Option 3, offline: a self-contained plugin you copy in, for build machines that cannot reach the registry.

On the CLI and Package Manager paths, two things authenticate the Android build to the registry: the Custom Main Gradle Template and your app API key. iOS needs no registry key on any path, since its framework is bundled.

Section titled “Option 1: Install with the Alphyn CLI (recommended)”
Terminal window
alphyn-cli integrate --android-api-key <key>

It vendors the C# plugin under Assets/AlphynSDK, wires the Android SDK to resolve from the Alphyn package registry through the project’s custom Main Gradle Template (Assets/Plugins/Android/mainTemplate.gradle), and places the iOS Alphyn.xcframework. The Android .aar is not copied into your project; it is fetched from the registry at build time.

Then, in Player Settings > Publishing Settings, enable Custom Main Gradle Template (Unity only uses mainTemplate.gradle when this is on; if the file did not exist, the CLI creates a minimal one, so review it against your Unity version’s default), and export your key:

Terminal window
export ALPHYN_REGISTRY_KEY=<YOUR_APP_API_KEY>

Option 2: Install from the registry, by hand (no CLI)

Section titled “Option 2: Install from the registry, by hand (no CLI)”

Add the com.byterialab.alphyn-sdk package through the Unity Package Manager. The package carries the C# and the iOS framework; the Android .aar still resolves from the registry Maven, so you also wire the Gradle template and the key.

Before you start: register your Android and iOS apps and generate their API keys (see How to Register Your App).

Step 1. Add the Alphyn scoped registry to Packages/manifest.json:

{
"scopedRegistries": [
{ "name": "Alphyn", "url": "https://packages.byterialab.com/npm", "scopes": ["com.byterialab"] }
],
"dependencies": { "com.byterialab.alphyn-sdk": "<version>" }
}

Step 2. Authenticate the Package Manager through ~/.upmconfig.toml (the user is the literal x, the password is your app API key, base64-encoded together as x:KEY):

[npmAuth."https://packages.byterialab.com/npm"]
_auth = "<base64 of x:YOUR_APP_API_KEY>"
alwaysAuth = true

Generate the value with printf 'x:%s' "$ALPHYN_REGISTRY_KEY" | base64. See SDK Registry Access.

Step 3. Wire the Android registry Maven for the .aar. In Player Settings > Publishing Settings, enable Custom Main Gradle Template, add the authenticated Alphyn Maven to the template’s repositories block, and export your key:

// Assets/Plugins/Android/mainTemplate.gradle, inside allprojects { repositories { ... } }
maven {
url 'https://packages.byterialab.com/maven'
credentials { username 'x'; password System.getenv('ALPHYN_REGISTRY_KEY') ?: '' }
}
Terminal window
export ALPHYN_REGISTRY_KEY=<YOUR_APP_API_KEY>

Expected result: the Package Manager resolves com.byterialab.alphyn-sdk, and the Android build resolves the .aar from the registry. If resolution fails, recheck the ~/.upmconfig.toml auth and the Gradle template.

Option 3: Install offline (self-contained plugin)

Section titled “Option 3: Install offline (self-contained plugin)”

If your build cannot reach the registry, copy the self-contained plugin instead; it carries the native binaries and needs no registry key. Download the plugin from your app’s SDK Downloads page and lay it out as:

YourProject/
├── Assets/
│ ├── AlphynSDK/
│ │ ├── Plugins/
│ │ │ ├── Android/
│ │ │ │ └── alphyn-sdk.aar
│ │ │ └── iOS/
│ │ │ └── Alphyn.xcframework
│ │ ├── Scripts/
│ │ │ ├── AlphynSDK.cs
│ │ │ ├── AlphynException.cs
│ │ │ └── ScanResult.cs
│ │ └── Editor/
│ │ └── AlphynSDKEditor.cs

With the bundled .aar in place you do not need the mainTemplate.gradle registry wiring or the registry key.

For Android: In Edit > Project Settings > Player > Android

  • Set Minimum API Level to 26 or higher
  • Enable ARM64 and ARMv7 architectures

For iOS: In Edit > Project Settings > Player > iOS

  • Set Target minimum iOS Version to 15.0 or higher
  • The xcframework is linked automatically during build