Skip to content

fix(mobile): iOS dictation keeps recording when you lock the phone or switch apps - #1

Open
fishdogdev wants to merge 1 commit into
mainfrom
fix/ios-background-dictation
Open

fishdogdev wants to merge 1 commit into
mainfrom
fix/ios-background-dictation

Conversation

@fishdogdev

@fishdogdev fishdogdev commented Nov 12, 2026 •

Copy link
Copy Markdown

Approval:

On iPhone, locking the phone or switching apps mid-dictation throws away everything recorded so far. expo-audio pauses the recorder as soon as the app leaves the foreground, VoiceInputController.appMovedToBackground then treats the dictation as interrupted and deletes the file, and the user comes back to "Voice recording was interrupted." with a Retry that starts from nothing. Glancing at another app or the phone locking itself is the usual way this happens.

Fix

  • iOS keeps the dictation running. The recording audio mode sets expo-audio's allowsBackgroundRecording, and appMovedToBackground({ keepRecording: true }) leaves a running recording alone. Coming back and pressing the check mark inserts the whole transcript.
  • Bounded to the dictation the user started. The microphone stays on only until they finish or cancel that dictation, under the existing five-minute recording cap. iOS shows its microphone indicator the whole time. The flag is set only on recording sessions and resets when the session is released, so playback and idle states are unchanged.
  • No new capability. The app already ships UIBackgroundModes: ["audio"] (used today for picture in picture) and the microphone permission. There is no new entitlement, permission, Info.plist key, setting, or native rebuild.
  • Calls and Siri. iOS pauses the recorder for them without a status event, and with background recording allowed expo-audio no longer resumes it. Returning to the app with a recorder that is no longer capturing transcribes what was captured instead of leaving dictation stuck.
  • Android cannot record in the background without a microphone foreground service, which the app does not ship. Leaving the app there now finishes the dictation and transcribes what was captured instead of deleting it, using the same controller path.
  • Preparation is still cancelled on background, as before. docs/user/composer.md describes both platforms.

Scope

This is the narrow part of #10140. That PR added an app-scoped recording session that followed the user across drafts and threads, and its review asked for approval of the background-recording direction and scope. This PR has no app-scoped session and does not touch drafts, threads, or navigation; it only stops an in-progress dictation from being thrown away when the app leaves the foreground. It does keep the microphone on after leaving the app for that dictation, and approval for exactly that scope is linked above. Idea: #25019 (converted from #24927).

Verification

  • packages/client-runtime: vp test run src/voice-input/controller.test.ts. The new case fails on main (expected 'error' to be 'recording') and passes here; the existing preparation case still passes.
  • apps/mobile: vp test run src/features/voice-input/voiceInputSession.test.ts src/features/voice-input/voiceRecordingPermission.test.ts covers the call/Siri recovery and that Android's permission dialog neither interrupts nor resumes dictation.
  • vp run check:changed passes.
  • Physical iPhone: started dictation, left the app while speaking, came back and finished; the transcript included what was said while away.
  • iOS 27.2 simulator, same steps with speech while on the home screen:
    • Before (main): "Voice recording was interrupted." and nothing is inserted.
    • After: still recording on return (0:22); finishing inserts the speech from before, during, and after leaving.
  • Android 16 emulator (Pixel 9), transcribing on an environment: started dictation, pressed Home for 15 s, came back. On main the recording is discarded with no transcription request. Here it is finished and sent for transcription (POST /api/voice/transcribe, 200) and dictation returns to idle with no error. The emulator microphone is silent, so this shows the stop-and-transcribe path, not transcript text.
  • Not checked on a device: an incoming call during a backgrounded iOS recording (covered by the session test).

Written with Claude Opus 5.5 in Claude Code; reviewed with Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code

…s to the background

Locking the phone or switching apps while dictating treated the recording as
an interruption: the captured audio was deleted and the composer showed
"Voice recording was interrupted." with nothing to retry from. Natively,
expo-audio also paused the recorder on background because the recording audio
mode never allowed background recording.

iOS now sets allowsBackgroundRecording for recording sessions and leaves a
running recording alone when the app goes to the background; returning with a
recorder the system paused (call, Siri) finishes and transcribes it. Android,
which cannot record in the background without a microphone foreground service,
stops and transcribes what was captured instead of discarding it. Preparation
is still cancelled on background, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@fishdogdev
fishdogdev force-pushed the fix/ios-background-dictation branch from 92470b2 to 6295dde Compare November 12, 2026 04:09
@fishdogdev fishdogdev changed the title fix(mobile): dictation no longer loses the recording when the app goes to the background fix(mobile): iOS dictation keeps recording when you lock the phone or switch apps Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant