Implementation guide · Android native bridge

Amazon Chime Android SDK inside Unity

Unity owns the smart-glass experience. The native Android SDK owns real-time audio and video. A small bridge lets both do the job they are good at—without putting AWS credentials in the app.

Native media connected on Android 14 emulator Unity 6 · Android Project SDK pin: 0.25.3 XREAL build target included
The important distinction: calling the Chime meeting API creates a meeting and attendee, but it does not carry sound or video. The Android client SDK establishes the WebRTC media session. In Unity, that SDK runs through an Android Java bridge.

Architecture

One meeting, two planes

Keep the AWS control plane on your server and the media plane on the Android device. The app receives only short-lived meeting and attendee credentials.

Unity

Scene and C# UI

Lobby, buttons, captions, status and XREAL interaction.

→
JNI bridge

C# ↔ Java

AndroidJavaClass calls native methods; JSON events return to Unity.

→
Android

Chime media SDK

Meeting session, microphone, camera, remote tiles and WebRTC transport.

Backend path: Unity → HTTPS API → Lambda/Hono service → Chime CreateMeeting + CreateAttendee → return { Meeting, Attendee } JSON. Never ship IAM keys in the APK.

Responsibilities

Draw the boundary before writing code

Control plane · server

Create and authorize

Authenticate the user, choose the media region, call CreateMeeting and CreateAttendee, store room state, then return only the join response to the authorized client.

Media plane · Android app

Connect and render

Build a MeetingSessionConfiguration, start audio, start remote video, publish the local camera, observe attendees and bind video tiles to an Android render view.

Implementation

Build the bridge in seven steps

1

Return the standard Chime join response

Your API should return the AWS Meeting and Attendee objects together. The Android bridge needs the media URLs, meeting ID, attendee ID and join token. The server keeps its AWS credentials; the Unity app never receives them.

2

Add the Android SDK to Unity's Gradle project

This project injects the Maven dependency during Android post-processing, which avoids maintaining a generated Gradle project by hand. Pin and test a version before upgrading.

Gradle dependency used by this project
dependencies {
    implementation 'software.aws.chimesdk:amazon-chime-sdk:0.25.3'
}
3

Declare media permissions and the Android 14 service

Add INTERNET, CAMERA, RECORD_AUDIO, MODIFY_AUDIO_SETTINGS, FOREGROUND_SERVICE and FOREGROUND_SERVICE_MICROPHONE. Ask the user for camera and microphone permission at runtime. Android 14 also requires a foreground microphone service while the call is active.

4

Call Java from a small C# facade

Compile this path only for an Android player. The Unity Editor can exercise the API and UI, but it cannot load the Android Chime runtime.

ChimeAndroidBridge.cs
#if UNITY_ANDROID && !UNITY_EDITOR
using var bridge = new AndroidJavaClass(
    "com.technobrave.meet.ChimeUnityBridge");
bridge.CallStatic("initialize", "MeetLobbyApp");
bridge.CallStatic("joinMeeting", joinResponseJson);
#endif
5

Create the native meeting session

Parse the join response, construct MeetingSessionConfiguration, then create DefaultMeetingSession. Register observers before starting media so Unity receives the complete state transition.

ChimeUnityBridge.java — shortened
MeetingSessionConfiguration config =
    new MeetingSessionConfiguration(
        new CreateMeetingResponse(meeting),
        new CreateAttendeeResponse(attendee));

meetingSession = new DefaultMeetingSession(
    config, logger, activity.getApplicationContext());
audioVideo = meetingSession.getAudioVideo();
audioVideo.addAudioVideoObserver(this);
audioVideo.addVideoTileObserver(this);
audioVideo.addRealtimeObserver(this);
audioVideo.start();
audioVideo.startRemoteVideo();
6

Bind remote tiles and control local media

Implement VideoTileObserver. When a remote tile is added, create a DefaultVideoRenderView on the Android UI thread and call bindVideoView. Use the SDK's local video and realtime audio methods behind Unity's Camera and Mic buttons.

7

Send native state back to the Unity scene

Return small JSON events instead of letting C# poll Android. The target GameObject must exist and the callback method must be public.

Java → Unity callback
event.put("type", type);
event.put("message", message);
UnityPlayer.UnitySendMessage(
    "MeetLobbyApp",
    "OnNativeChimeEvent",
    event.toString());

Project map

Where the working code lives

These paths are relative to the Unity repository. The native bridge is intentionally isolated from the lobby UI so it can be replaced or tested independently.

Assets/Meet/Scripts/ChimeAndroidBridge.cs

C# facade for initialize, join, leave, microphone and camera.

Assets/Plugins/Android/ChimeUnityBridge.java

Native Chime meeting session, observers, render view and events.

Assets/Meet/Editor/ChimeAndroidBuildPostprocessor.cs

Injects the SDK dependency, permissions and foreground service.

Assets/Meet/Editor/MeetAndroidBuild.cs

Separate emulator and XREAL builds with temporary loader settings.

Assets/Meet/Scripts/MeetLobbyController.cs

Calls the backend, passes join JSON to Android and updates the UI.

Assets/Meet/Scenes/MeetLobby.unity

The test scene with the stable MeetLobbyApp callback target.

Build targets

Test each layer in the right place

TargetWhat worksWhat does notUse it for
Unity EditorPartial Lobby, HTTPS API and UI stateAndroid SDK, real audio/video and Java bridgeFast UI and backend iteration
Android emulatorSupported Native bridge, signaling, audio and video lifecycleReliable physical camera/mic behavior; XREAL display pathIntegration and log testing
Android phoneSupported Full Chime audio/video with real hardwareXREAL-specific rendering unless glasses are attached and supportedTwo-participant media proof
XREAL / Beam ProTarget Chime media plus the Unity XR experienceNothing by design; validate device firmware and Eye camera pathReal worker workflow and acceptance test

Proof

The native session reached Chime

On an ARM64 Android 14 emulator, the current bridge produced this state sequence. A remote video tile still requires a second participant who is publishing a camera.

# Android native event sequence
bridge_ready
connecting
audio_connecting
audio_connected
video_connected
camera_available
attendee_joined

Debugging

Read the symptom at the correct layer

SymptomLikely layerCheck first
Room exists, but no mediaAndroid bridgeConfirm joinMeeting ran and look for audio_connecting.
Only bridge_readyAPI / Unity controllerInspect the join HTTP response and confirm it contains both objects.
Audio connects, no remote videoParticipant / tile bindingVerify another client is sending camera video and log onVideoTileAdded.
Camera or mic failsAndroid permissionRuntime grants, manifest entries, emulator virtual devices and Android 14 service.
Works in Editor, not APKGradle / JNIInspect adb logcat for missing class, Maven or manifest errors.
APK starts but XREAL failsXR loaderUse the XREAL build menu; the emulator build deliberately disables its loader.

Before production

What remains after “connected”

Primary sources

Use the SDK contract, not guesses

AWS GitHubAmazon Chime SDK for Android AWS Developer GuideCreate meetings and attendees Android APIDefaultMeetingSession Android APIVideoTileObserver AWS Developer GuideWebRTC media behavior and limits AWS API ReferenceAmazon Chime SDK API

Continue with the complete smart-glass stack

XREAL SDK, camera flow, testing constraints and deployment are covered in the main development guide.

Open development guide →