Mobile Integration
TinyEmulator uses Capacitor 7.0 for native mobile app builds.
Supported Platforms
| Platform | Status | Build Command |
|---|---|---|
| iOS | ✅ Ready | npm run build-ios |
| Android | ✅ Ready | npm run build-android |
| HarmonyOS | ✅ Ready | npm run build-harmony |
Capacitor Configuration
// capacitor.config.json
{
"appId": "com.xxyx.emulator",
"appName": "TinyEmulator",
"webDir": "dist",
"plugins": {
"StatusBar": {
"overlaysWebView": false
}
}
}
Native Plugins
TinyEmulator includes the following Capacitor plugins:
| Plugin | Purpose |
|---|---|
@capacitor/app | App lifecycle management |
@capacitor/haptics | Vibration feedback |
@capacitor/share | Native share sheet |
@capacitor/status-bar | Status bar control |
@hugotomazi/capacitor-navigation-bar | Android navigation bar |
capacitor-plugin-safe-area | Safe area insets |
Building iOS App
# 1. Build the web assets
npm run build-ios
# 2. Open Xcode
npx cap open ios
# 3. Archive and publish to App Store
Building Android App
# 1. Build the web assets
npm run build-android
# 2. Open Android Studio
npx cap open android
# 3. Build APK / AAB
Building HarmonyOS App
# Build as single file (for HarmonyOS WebView)
SINGLE_FILE=true TARGET=HARMONY vite build --mode harmony
URL Scheme Integration
TinyEmulator registers the tinyemulator:// URL scheme for deep linking.
Open the app from a web page
<a href="tinyemulator://startup?core=nes&rom=game.nes">
Open in TinyEmulator App
</a>
Smart Lancher
The lancher page handles app detection:
// Mobile: tries to open app, falls back to download
// Desktop: redirects to web emulator
import CallApp from 'callapp-lib';
const lib = new CallApp({
scheme: 'tinyemulator://',
path: 'startup',
outChain: {
path: '',
params: {}
}
});
lib.open({ path: '/startup', param: { core: 'nes' } });
Custom App Integration
To embed TinyEmulator into your own mobile app:
1. WebView Integration
// iOS - WKWebView
let webView = WKWebView(frame: .zero)
webView.load(URLRequest(url: URL(string: "https://play.tinyemulator.com")!))
// Android - WebView
val webView = WebView(context)
webView.settings.javaScriptEnabled = true
webView.loadUrl("https://play.tinyemulator.com")
2. Capacitor Integration in Your App
# Install TinyEmulator as a dependency
npm install github:SowrdLonn/tinyemulator
# Use as a Capacitor plugin
npx cap add ios
npx cap add android