RORK LABJP
ENGINE — Rork Max is powered by Claude Code and Claude Opus 4.6, generating native Swift apps directlyCORE ML — Rork Max reaches on-device Core ML inference alongside HealthKit, HomeKit, NFC, and App ClipsSEED — Rork raised a $15M seed led by Left Lane Capital in April 2026, joined by Peak XV and a16z SpeedrunM&A — Rork acquired the app builder Paperline and says it will stay acquisitive to bring in engineering talentMARKET — Gartner expects 75% of new applications to be built with low-code or no-code tools by the end of 2026GROWTH — The no-code AI platform market is projected to grow from $4.9B in 2024 to $24.8B by 2029ENGINE — Rork Max is powered by Claude Code and Claude Opus 4.6, generating native Swift apps directlyCORE ML — Rork Max reaches on-device Core ML inference alongside HealthKit, HomeKit, NFC, and App ClipsSEED — Rork raised a $15M seed led by Left Lane Capital in April 2026, joined by Peak XV and a16z SpeedrunM&A — Rork acquired the app builder Paperline and says it will stay acquisitive to bring in engineering talentMARKET — Gartner expects 75% of new applications to be built with low-code or no-code tools by the end of 2026GROWTH — The no-code AI platform market is projected to grow from $4.9B in 2024 to $24.8B by 2029
Articles/Dev Tools
Dev Tools/2026-06-26Advanced

Keep Audio Playing in the Background and Add Lock Screen Controls in a Rork App

How to make a Rork-generated Expo app keep playing music or healing sounds in the background and expose lock screen and Control Center controls, with working expo-audio code and the platform-specific gotchas.

Rork498Expo139expo-audio2React Native201background audio2

Premium Article

The first thing that betrays you when you build a sound app is the moment the audio that played perfectly in preview goes silent the instant you return to the home screen or lock the device. When I rebuilt Relaxing Healing — a sleep and meditation sound app I have run as a personal developer for years — in Rork, the freshly generated code only played in the foreground. For an app people use right before falling asleep, going silent the moment the screen turns off is a fatal flaw.

Rork outputs React Native (Expo) code, so this is not a Rork-specific problem; it is solved in Expo's audio configuration. But pasting the official minimal sample as-is gives you no lock screen play button, and on Android the audio quietly stops after a few minutes. Here is the implementation that makes both background playback and lock screen controls work, using expo-audio (Expo SDK 54), laid out in the order I hit each wall.

Why generated code stops in the background

"Just playing" audio and "keeping audio playing while the app is backgrounded" are, from the OS's point of view, two different permissions. The former works with the default audio session state; the latter only works once three things are all in place.

First, on iOS, unless you declare audio in the background execution modes, the audio session is suspended the moment the app moves to the background. Second, you need to switch the audio session itself into a mode that plays in the background. Third, on Android, unless you actively post a lock screen (media) notification, the OS stops the process's audio after about three minutes. Generated code usually satisfies none of these three.

1. Add expo-audio and declare background mode

Add expo-audio to the project you exported from Rork, and enable iOS background audio through the plugin configuration in app.json (or app.config.js). Writing it via the plugin sets UIBackgroundModes without you touching the native Info.plist.

{
  "expo": {
    "plugins": [
      [
        "expo-audio",
        {
          "microphonePermission": false
        }
      ]
    ],
    "ios": {
      "infoPlist": {
        "UIBackgroundModes": ["audio"]
      }
    },
    "android": {
      "permissions": ["android.permission.FOREGROUND_SERVICE", "android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"]
    }
  }
}

Build a dev build without this, and you get a low-reproducibility bug: it appears to work in the iOS simulator but stops the instant you background it on a real device. I burned half a day on exactly this gap, so I strongly recommend declaring it up front. After changing the config you need npx expo prebuild and a rebuild (UIBackgroundModes is not honored in Expo Go).

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Turn a sound or music app that goes silent on screen lock into one that keeps playing with full lock screen controls
You'll learn the correct pairing of expo-audio's setAudioModeAsync and setActiveForLockScreen, with code that runs
Ship with the iOS/Android divergences already handled — the Android 3-minute cutoff and interruption recovery
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-07-10
Adding React Compiler to Expo Let Me Delete 41 Hand-Written memo Calls
I enabled React Compiler on Rork-generated React Native screens and measured the rerender counts with Profiler. Here is how I decided which memo and useCallback calls were safe to delete, how to find the components the compiler bailed out on, and how to catch regressions in CI.
Dev Tools2026-07-07
The App Icon Badge Still Says 3 — Rebuilding Expo Badge Counts Around a Single Source of Truth
Why an Expo app's icon badge drifts out of sync with real unread counts and refuses to clear — and how to rebuild it around a single source of truth, with working recompute-and-sync code and the production pitfalls that bite you.
Dev Tools2026-07-04
Should You Show a Read More Link? Let the Rendered Text Decide in Rork (Expo)
Clamping a product description to three lines and adding a Read more toggle sounds simple, until the toggle also appears under single-line text. This walks through measuring the real line count with onTextLayout so the toggle only shows when text actually overflows, covering iOS vs Android quirks, expand animation, and font scaling.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →