Skip to Content
Get StartedEmbed Android Emulator Streaming in Your Web App

Embed Android Emulator Streaming in Your Web App

Overview

Limbar enables developers to stream Android emulators in browser using WebRTC technology that provides low latency and high quality video with adaptive bitrate that automatically adjusts to your network conditions - the same tech used in game streaming platforms. This allows you to embed interactive Android emulators directly in your web applications with minimal latency and no local installation requirements.

See the online demo to get a feel for how it works.

Key benefits of embedding Limbar’s Android emulator:

  • Low latency streaming - Real-time interaction with the virtual device
  • No local installation - Everything runs in the cloud with browser-based access
  • Adaptive bitrate - Automatically adjusts to network conditions for smooth operation
  • Cross-platform compatibility - Works in any modern browser on desktop and mobile

How to stream Android Emulator in browser

Full Example

If you’d like to jump right in, here’s a full example of how to embed a Limbar Android emulator in a web app. This example demonstrates the complete integration process for streaming virtual Android devices.

Steps

Create an organization token

In order to create Android emulator instances, you need to make a request to one of the region APIs and that requires an organization token to authenticate.

Go to Settings page in Limbar Console, click on the API Tokens tab and create a new token.

Add a creation endpoint to your web app

The organization token you created above should never be exposed to the client side code as it grants full access to create and manage Android emulator instances.

So, you’ll need to add a very simple endpoint in your backend that will let only your authorized users create Android emulator instances.

Assuming there is a middleware that authenticates the request before it hits this endpoint, here is a single file example of how to do that in NodeJS:

const apiToken = process.env.API_TOKEN; const organizationId = process.env.ORGANIZATION_ID; const region = process.env.REGION; const apiUrl = `https://${region}.limbar.net/apis/android.limbar.io/v1alpha1/organizations/${organizationId}/instances`; app.post('/create-instance', async (req, res) => { try { const { name } = req.body; if (!name) { return res.status(400).json({ status: 'error', message: 'name is required' }); } const response = await fetch(apiUrl, { method: 'PUT', headers: { 'Authorization': `Bearer ${apiToken}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ instance: { metadata: { name: name, organizationId: organizationId }, }, wait: true }) }); const data = await response.json(); if (!response.ok) { // Read the response body as text to get the error message return res.status(response.status).json({ status: 'error', message: `Request failed: ${data.message}` }); } return res.status(200).json({ name, webrtcUrl: data.status.webrtcUrl, token: data.token, }); } catch (error) { return res.status(500).json({ status: 'error', message: 'Failed to create Android instance: ' + error.message }); } });

You can see the full API reference here.

Add RemoteControl component to your app

In your frontend code, you can use the webrtcUrl and token to initialize the RemoteControl component for embedding the Android emulator stream.

import { RemoteControl } from '@limbar/ui'; function MyAppPreviewPage() { return ( <RemoteControl url="https://your-webrtc-url" token="your-auth-token" className="w-full h-full object-cover" openUrl="exp://will-open-immediately.expo.dev" /> ); }

@limbar/ui is written in TypeScript so you can inspect all the props and types of the RemoteControl component.

Start streaming

Once the RemoteControl component is initialized, it will start streaming the Android emulator video to your web app. Users can interact with the virtual device directly through their browser.

How to stream Android Emulator in browser

Advanced

You can simultaneously run an lim connect in your backend while the emulator is streaming to be able to install any apps you want to test through the adb commands. This enables advanced Android debugging and app installation capabilities.

lim connect android 81w1qbt4bf --stream false

Example commands that become available once the lim connect command is running:

  • Run Expo development server

    npx expo start --android
  • Install expo development build

    eas build --profile development --platform android --non-interactive
  • Install any APK

    adb install app-release.apk

Frequently Asked Questions

Q: Can I embed multiple emulators on the same page?
A: Yes, you can create multiple instances of the RemoteControl component with different URLs and tokens to stream several Android emulators simultaneously.

Q: What’s the bandwidth requirement for a good experience?
A: We recommend at least 5 Mbps download speed for optimal performance, though adaptive bitrate will work with lower speeds.

Q: Can I install my own apps on the emulator?
A: Yes, use the lim connect command as shown in the Advanced section to access ADB and install custom APKs.

Q: Is the connection secure?
A: Yes, all connections are encrypted using WebRTC’s built-in security features and our authentication tokens.

Q: Which browsers support Android emulator streaming?
A: All modern browsers with WebRTC support can stream Android emulators, including Chrome, Firefox, Safari, and Edge.

Q: Can I customize the appearance of the embedded emulator?
A: Yes, the RemoteControl component accepts standard styling props to fit your application’s design.

Last updated on