算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
hz-android-2d-porting【设计与创意】Guides porting existing Android 2D apps to Meta VR and Horizon OS — input adaptation, panel layout, and design requirements. Use when adapting a mobile Android app for Meta VR. For UI design decisions, use hz-panel-designer if available. Build path: Standard Android; use hz-quest-verify-first if the build path is unclear.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when:
Horizon OS is built on Android (AOSP) and can run standard Android applications inside panels -- floating 2D windows positioned in 3D space. Most well-built Android apps work on Meta VR devices with minimal changes, but several areas require attention:
The goal of porting is to make the app feel native to the Meta VR experience while preserving existing functionality.
Build and install the existing app with its normal Android workflow. Android Studio, Gradle, and adb all work with a connected Meta VR device:
./gradlew installDebug
adb shell am start -n com.example.yourapp/.MainActivity
Prefer metavr app install <apk> and metavr app launch <package> over raw adb here, then stream metavr adb logcat --follow during this first run. Note any immediate crashes, black screens, input problems, or layout breakage.
Check whether the app depends on Google Play Services, unsupported hardware, or prohibited permissions before changing its UI. Make unsupported features optional or replace them with Horizon OS alternatives. See Compatibility Requirements.
The most common porting issue is input. Touch events are translated from the controller pointer, but:
See Input Adaptation Reference for detailed guidance.
Panels are resizable and can have various aspect ratios. Your app must handle:
Use responsive Android layouts and window-size breakpoints. See Panel Layout Reference.
Update your build configuration to target Horizon OS:
// build.gradle.kts
android {
defaultConfig {
minSdk = 29 // Android 10 minimum
targetSdk = 34 // API 34 or higher required for all new 2D panel apps
}
}
Add required manifest entries for device targeting. See Gradle Setup Reference.
Test with all supported input methods:
Use the Meta Spatial Simulator for rapid desktop iteration, then validate on-device with the Meta Horizon OS Android Studio plugin or normal ADB tooling. Keep metavr adb logcat --follow running during each input pass — it catches input errors that don't visibly crash.
Before submitting to the Horizon Store:
| Feature | Status | Notes |
|---|---|---|
| Standard Android Views | Supported | TextView, RecyclerView, etc. |
| Jetpack Compose | Supported | Full Compose UI toolkit |
| React Native | Supported | Uses the standard Android application path |
| WebView | Supported | Chromium-based |
| Media playback (ExoPlayer) | Supported | Video and audio |
| Networking (HTTP, WebSocket) | Supported | Wi-Fi connectivity |
| Room / SQLite | Supported | Local database |
| WorkManager | Supported | Background tasks |
| Notifications | Supported | Horizon OS notification panel |
| Bluetooth (peripherals) | Supported | Keyboard, mouse, gamepad |
| Android Accessibility APIs | Supported | TalkBack equivalent available |
| Feature | Status | Notes |
|---|---|---|
| Telephony / SMS | Not available | No cellular radio |
| NFC | Not available | No NFC hardware |
| GPS / Fine location | Limited | Wi-Fi-based location only |
| Fingerprint / BiometricPrompt | Not available | Use Meta account auth instead |
| Multiple app-owned panels | Limited | Use the current public multi-panel guidance when available |
| Google Play Services | Not available | Use Meta equivalents or alternatives |
| ARCore | Not available | Use Meta Spatial SDK for spatial features |
| Multi-touch gestures | Limited | Single pointer from controller |
| Issue | Cause | Fix |
|---|---|---|
| App crashes on launch | Missing Google Play Services dependency | Remove or make GMS optional |
| Buttons too small to tap | Touch targets under 48dp | Increase minimum tap target size |
| Keyboard doesn't appear | Custom input field not using InputConnection | Use standard EditText or TextField |
| Layout broken | Fixed-size layout assumptions | Use responsive Views or Compose layouts |
| App requests unavailable permissions | Telephony, NFC, or other absent hardware | Guard with hasSystemFeature() checks |
| APK rejected for prohibited permissions | Library or plugin silently added a prohibited permission | Run aapt dump permissions your-app.apk, then check prohibited list |
| APK rejected for invalid signature | Signed with v1-only scheme | v2 signing is default in AGP 7.0+; for older AGP, add v2SigningEnabled = true to your signing config |
Meta VR devices have mobile-class hardware with strict thermal limits: