DEV Community

Cover image for Remote Compose: The Future of Dynamic Android UIs (And How It Compares to SDUI)
supriya shah
supriya shah

Posted on

Remote Compose: The Future of Dynamic Android UIs (And How It Compares to SDUI)

Originally published on Medium:

https://medium.com/@supsabhi/remote-compose-the-future-of-dynamic-android-uis-and-how-it-compares-to-sdui-444a9430de13?sharedUserId=supsabhi

Imagine you run a shopping app. Black Friday is tomorrow. Your design team wants a giant banner on the home screen. Normally, that means a code change, a PR, a review, a build, a Play Store submission, and then… waiting 2–3 days for approval.

What if you could just push that banner from your server — instantly, to all users — without touching the app code at all?

That’s exactly the problem Remote Compose (and its older cousin, SDUI) are built to solve.

First, Let’s Understand the Problem
In a traditional Android app, your UI is baked into the APK. You ship it, users install it, and it stays that way until the next update. This is fine for stable features, but terrible for:

A/B testing — want to test two versions of a checkout button? That’s a whole release cycle.
Dynamic promotions — flash sales, seasonal banners, real-time feature flags.
Fixing a broken layout — you spotted a UI bug in production. Users are stuck with it for days.
The dream is a UI that your backend can control in real time. That’s where server-driven UI comes in.

What is Server-Driven UI (SDUI)?

SDUI is an architectural pattern where the server tells the app what to render, rather than the app deciding on its own.

Instead of your Android code hardcoding if (isPromoWeek) showBanner(), the server sends down a JSON payload that says: "render a banner component with this title, this color, and this action."

The app becomes a dumb renderer. It just reads the JSON and draws what it’s told.

A Simple SDUI Example

Server sends this JSON:

{
  "type": "banner",
  "title": "50% Off Today Only!",
  "backgroundColor": "#FF5722",
  "action": {
    "type": "navigate",
    "screen": "deals"
  }
}

Enter fullscreen mode Exit fullscreen mode

Your Android app parses this and renders a banner. The server changes the JSON tomorrow — the banner disappears. No app update.

The Classic SDUI Code Pattern (XML/View era)
// Old-school SDUI with Views

fun renderComponent(component: ComponentModel, parent: ViewGroup) {
    when (component.type) {
        "banner" -> {
            val banner = BannerView(context)
            banner.setTitle(component.title)
            banner.setBackgroundColor(Color.parseColor(component.backgroundColor))
            parent.addView(banner)
        }
        "button" -> {
            val btn = Button(context)
            btn.text = component.label
            parent.addView(btn)
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

It works, but it’s verbose, error-prone, and managing state across dynamic Views is painful. Every new component type needs a new when branch, manual view inflation, and careful lifecycle management.

Enter Remote Compose

Remote Compose is SDUI — but reimagined for the Jetpack Compose era.

Instead of inflating Views from JSON, your server sends a Compose-compatible UI description, and the client renders it using Compose’s declarative system. It’s cleaner, more expressive, and far easier to maintain.

Think of it this way: SDUI was the answer to “how do we make dynamic UIs?” Remote Compose is the answer to “how do we make dynamic UIs well, in 2024+?”

Remote Compose vs SDUI: The Core Difference

Both solve the same problem, but they’re built for different eras of Android development.

Classic SDUI runs on the old View system — you inflate XML layouts, wire up TextViews and Buttons manually, and manage state yourself. It gets the job done, but the boilerplate piles up fast. Remote Compose swaps all of that for Jetpack Compose’s declarative model, so the rendering is cleaner and state is handled naturally by the runtime.

The payload is different too. SDUI typically sends plain JSON that your app parses into component types. Remote Compose sends a structured UI tree — closer to actual Compose nodes — which the client renders directly without a component-by-component when switch.

Animations and theming are where the gap really shows. In classic SDUI, adding smooth transitions across dynamically rendered Views is genuinely painful. In Remote Compose, animations are just… Compose animations. They work the same way they always do.

The tradeoff is maturity. SDUI has been battle-tested at companies like Airbnb and Twitter for years. Remote Compose is newer and still evolving — great for greenfield projects, but you’ll occasionally hit rough edges in tooling.

How Remote Compose Actually Works

Remote Compose works in three steps:

1. Server serializes a Compose UI tree

Instead of a full Compose function running on the server, the server produces a description of what the UI should look like — a tree of UI nodes (text, image, button, column, row, etc.) encoded as a compact binary or JSON payload.

2. Client receives and deserializes the tree

The app receives this payload, parses it into a local representation of Compose nodes.

3. Client renders using Compose
The local Compose runtime renders those nodes just like normal Compose composables — with full support for recomposition, state, and animations.

Let’s Code — Setting Up

// Dependency in build.gradle
implementation("androidx.remotecallback:remotecallback:1.0.0-alpha02")

// (Remote Compose is still evolving — check the latest alpha)

Server Side

The server produces a UI tree — here’s a conceptual example:


// Server generates this UI description
fun buildPromoUI(): RemoteViews {
    return remoteColumn {
        remoteText(
            text = "Flash Sale — 3 Hours Only!",
            fontSize = 24,
            color = Color.White,
            fontWeight = FontWeight.Bold
        )
        remoteSpacer(height = 8)
        remoteButton(
            label = "Shop Now",
            action = NavigateAction(screen = "deals"),
            backgroundColor = Color(0xFFFF5722)
        )
    }
}
Enter fullscreen mode Exit fullscreen mode

Client Side

@Composable
fun DynamicScreen(viewModel: DynamicViewModel) {
    val uiState by viewModel.remoteUI.collectAsState()
     when (uiState) {
        is Loading -> CircularProgressIndicator()
        is Success -> RemoteComposeRenderer(
            content = uiState.data,   // The server payload
            modifier = Modifier.fillMaxSize()
        )
        is Error -> Text("Couldn't load content")
    }
}
Enter fullscreen mode Exit fullscreen mode

The RemoteComposeRenderer is the magic piece — it takes the server payload and renders it as real Compose UI.

A Real-World Comparison: Home Screen Feature

Let’s build the same “promotional banner” feature in both approaches.

SDUI Approach (Classic)

Server JSON:


{
  "screen": "home",
  "components": [
    {
      "type": "promo_banner",
      "title": "Weekend Deal",
      "subtitle": "Up to 40% off",
      "image_url": "https://cdn.example.com/promo.png",
      "cta_text": "View Deals",
      "cta_action": "OPEN_DEALS_PAGE"
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Android Client (View-based SDUI):

data class ComponentModel(
    val type: String,
    val title: String? = null,
    val subtitle: String? = null,
    val imageUrl: String? = null,
    val ctaText: String? = null,
    val ctaAction: String? = null
)
fun renderSDUI(component: ComponentModel, container: LinearLayout) {
    when (component.type) {
        "promo_banner" -> {
            val view = layoutInflater.inflate(R.layout.promo_banner, container, false)
            view.findViewById<TextView>(R.id.title).text = component.title
            view.findViewById<TextView>(R.id.subtitle).text = component.subtitle
            Glide.with(context).load(component.imageUrl)
                .into(view.findViewById(R.id.image))
            view.findViewById<Button>(R.id.cta).apply {
                text = component.ctaText
                setOnClickListener { handleAction(component.ctaAction) }
            }
            container.addView(view)
        }
    }
}


Enter fullscreen mode Exit fullscreen mode

It works. But notice — every new component needs a new XML layout file, new when branch, and manual view wiring. Adding 10 component types means 10 layout files and 10 code paths.

Remote Compose Approach

Server produces a Compose tree (conceptual):

remoteColumn(
    modifier = RemoteModifier.padding(16)
) {
    remoteImage(
        url = "https://cdn.example.com/promo.png",
        contentScale = ContentScale.Crop,
        modifier = RemoteModifier.fillMaxWidth().height(180)
    )
    remoteSpacer(8)
    remoteText("Weekend Deal", style = RemoteTextStyle.headlineMedium)
    remoteText("Up to 40% off", style = RemoteTextStyle.bodyMedium, color = Color.Gray)
    remoteSpacer(12)
    remoteButton(
        text = "View Deals",
        onClick = RemoteAction.Navigate("deals_screen")
    )
}

Enter fullscreen mode Exit fullscreen mode

Client just renders it:

@Composable
fun HomeScreen() {
    val uiTree by viewModel.homeTree.collectAsState()
    RemoteComposePlayer(
        modifier = Modifier.fillMaxSize(),
        content = uiTree
    )
}

Enter fullscreen mode Exit fullscreen mode

That’s it. The client has zero knowledge of what “promo banner” means. It just renders whatever the server describes. Add a new section tomorrow — zero client code changes.

When to Use What
Stick with Classic SDUI if:

  • Your codebase is still View-based (XML layouts)
  • You need mature tooling and a well-documented pattern
  • Your team isn’t fully on Compose yet

Use Remote Compose if:

  • You’re building greenfield in Compose
  • You want animations, state, and theming to be part of the server-driven experience
  • You want to eliminate the rendering boilerplate that SDUI demands

Use neither if:

  • Your UI rarely changes (SDUI adds complexity — don’t pay for what you don’t need)
  • Your team is small and the release cycle is fast enough

The Gotchas Nobody Talks About

  1. Security. Your server controls what renders on screen. A compromised backend could push malicious UI. Always validate payloads server-side and sanitize actions on the client.

  2. Versioning. If your server sends a component your old app client doesn’t know how to render — what happens? You need a fallback strategy (skip unknown nodes, show placeholder, etc.).

  3. Accessibility. Server-driven UIs can break screen reader semantics if you’re not careful. Make sure your component contracts include accessibility labels.

  4. Debugging. “Why is my UI wrong?” becomes a multi-layer question — is it the server payload, the deserializer, or the renderer? Good logging at each layer is non-negotiable.

Wrapping Up

Remote Compose isn’t magic, and it’s not for every app. But if you’ve ever felt the pain of waiting 3 days for a Play Store review just to change a button color — this architecture is worth understanding deeply.

Start with SDUI if you’re new to server-driven patterns. It’ll teach you the fundamentals. Then, as your team adopts Compose, Remote Compose becomes the natural evolution.

The future of dynamic Android UIs is one where the server and client are true partners — the server owns what to show, and the client owns how to show it beautifully.

Happy composing. 🚀

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The versioning gotcha is the one that would bite me first. If the server sends a component an older client doesn't know how to render, does RemoteComposePlayer skip just that node, or does the whole screen fail? With users on mixed app versions, that fallback behavior would decide whether I'd risk it even for something small like a promo banner.