ai.metabind:metabind-content-android) fetches content from Metabind and renders it as native Jetpack Compose, so you can update layouts and experiences over the air without a Play Store release. It ships from the metabind-android repository alongside the agent libraries.
View on GitHub
metabind-android — source code, issues, and releases.Requirements
Installation
Add the SDK to your module’s dependencies. It pulls inbindjs-android (the Compose renderer) transitively.
- build.gradle.kts
- build.gradle
Upgrading from the old
ai.metabind:metabind-android artifact is a coordinate change only — the library keeps the ai.metabind.metabind package, so your imports don’t change.Configure endpoints and credentials
The SDK reads the Metabind API endpoints and credentials from yourAndroidManifest.xml as <meta-data> entries. The endpoint entries (url, ws.url) are required — the client throws at startup without them. The credential entries are optional and default to an empty string when omitted:
manifestPlaceholders in your build.gradle.kts, reading secrets from Gradle properties so they stay out of version control.
Quick start
Render content by its ID with theMetabindView composable. It fetches the content and its components, renders them as native Compose, and handles loading and error states:
Core concepts
MetabindView
MetabindView is the primary way to display content. Backed by MetabindViewModel, it:
- Fetches the content and its required components
- Renders the UI through the BindJS Compose runtime
- Subscribes to real-time updates when
enableSubscriptionistrue - Exposes a
StateFlow<UiState>ofLoading | Success | Error
PreviewView(contentId =)— a fixed-size (150×150 dp) live preview.ThumbnailView(contentId =)— an offscreen-rendered bitmap snapshot, for non-interactive thumbnails.
ComponentRepository
For direct data access below the view layer,ComponentRepository.get(context) exposes the Apollo-backed fetchers and a dual-layer cache (10 MB in-memory chained to a SQLite store). It returns suspend functions and Kotlin Flows — for example getContentByToken(token) for a one-shot read and subscribeToPreviewByToken(token) for a live stream over WebSocket.
Real-time updates
For live content, either passenableSubscription = true to MetabindView or subscribe directly through ComponentRepository. subscribeToPreviewByToken(token) returns a Flow that emits whenever the content changes in Metabind:
watchPreviewByToken(token) returns a Flow<Result<PreviewComponent>>.
Direct GraphQL access
For data access below the view layer,ComponentRepository exposes suspend fetchers and Kotlin Flows over the same GraphQL API and cache. See the repository on GitHub for the available methods, and the GraphQL docs for the API itself.
Next steps
Build components
Create custom components for your app.
BindJS reference
Learn the component authoring language.
Managing content
Understand how to structure content.
iOS SDK
The iOS equivalent.