From 5a1ce5fdba5c24fbbe0dc60f93b67fbe10582345 Mon Sep 17 00:00:00 2001 From: sravan Date: Mon, 27 Jul 2026 22:24:39 +0530 Subject: [PATCH] fix(ios): declare background audio so calls survive minimising the app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Capacitor/WebView apps get suspended by iOS a few seconds after backgrounding, which freezes the WebRTC mic + audio pipeline — so when the user minimised the app or locked the phone during a call, no one could hear anyone. Add UIBackgroundModes=[audio] to Info.plist (via ios-patch.sh) so iOS keeps the audio session (and the app) alive while a call is actively playing/recording. Video rendering still pauses in the background (unavoidable in a WebView) but voice continues. Needs a fresh Codemagic build. Co-Authored-By: Claude Opus 4.8 --- mobile/scripts/ios-patch.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mobile/scripts/ios-patch.sh b/mobile/scripts/ios-patch.sh index 20dd909..8008800 100644 --- a/mobile/scripts/ios-patch.sh +++ b/mobile/scripts/ios-patch.sh @@ -40,6 +40,17 @@ set_bool() { "$PB" -c "Add :$1 bool $2" "$PLIST" 2>/dev/null || "$PB" -c "Set :$ set_bool UIFileSharingEnabled true set_bool LSSupportsOpeningDocumentsInPlace true +# ── Keep CALL AUDIO alive when the app is BACKGROUNDED (minimised / screen locked) ────────────────── +# Without the 'audio' background mode, iOS suspends the WebView a few seconds after it backgrounds, which +# freezes the WebRTC mic + audio pipeline — so participants can't hear each other once the app is minimised +# or the phone locks. Declaring background audio keeps the audio session (and the app) running so a voice +# call continues in the background. (Video RENDERING still pauses while backgrounded — unavoidable in a +# WebView — but audio keeps flowing, which is what matters for a call.) Idempotent: rebuild the array each run. +"$PB" -c "Delete :UIBackgroundModes" "$PLIST" 2>/dev/null || true +"$PB" -c "Add :UIBackgroundModes array" "$PLIST" +"$PB" -c "Add :UIBackgroundModes:0 string audio" "$PLIST" +echo "UIBackgroundModes: audio (calls keep audio when minimised)" + # ── Custom URL scheme so the Share Extension can bounce the user back into the app ────────────────── # The extension stages the shared files into the App Group, then opens bizconnect://share; the app reads # the staged files and shows "Send to…". Registering the scheme is what makes that openURL succeed.