#50705·expo

[expo-audio][android] prepareToRecordAsync throws when notifications are denied and allowsBackgroundRecording is on, though Android doesn't need POST_NOTIFICATIONS for a foreground service

Author: carlesfernandeztenaCreated Sep 28, 2026Updated Sep 28, 2026
Labelsneeds reviewcontributor: external

Minimal reproducible example

https://github.com/carlesfernandeztena/expo-audio-background-recording-repro

Steps to reproduce

Platform: Android 13+ (API 33+). We hit this in our production app (store build, pnpm, expo-audio 57.0.5) on a Galaxy S24 with Android 16. The repro isolates the same configuration in a blank app (npm, development build).

  1. npm install, then npx expo run:android on an Android 13+ device or emulator. Background recording needs a development build.
  2. Tap Record and grant the microphone. The app never asks for notifications, so they stay off, which is the Android 13+ default.

Expected: recording starts. The foreground service runs, and its notice appears in Task Manager instead of the notification drawer.

Actual: prepareToRecordAsync() rejects, and the status text shows POST_NOTIFICATIONS permission has not been granted. This permission is required when using background recording (allowsBackgroundRecording: true). Turn on notifications for the app in system settings and Record works.

The rejection comes from this check in AudioRecorder.prepareRecording: https://github.com/expo/expo/blob/990f8adff1d9aa350671515fcc32364c1fab8811/packages/expo-audio/android/src/main/java/expo/modules/audio/AudioRecorder.kt#L92-L94

Android doesn't require this permission. From Notification runtime permission: "Apps don't need to request the POST_NOTIFICATIONS permission in order to launch a foreground service. However, apps must include a notification when they start a foreground service, just as they do on previous versions of Android." When the user has denied the permission, the system still lets the service run and lists it in Task Manager.

AudioRecordingService.startForegroundWithNotification() already posts the notification this requires and doesn't check the permission, so removing the gate is enough. This is the patch we're shipping (against expo-audio 57.0.5):

diff
--- a/android/src/main/java/expo/modules/audio/AudioRecorder.kt
+++ b/android/src/main/java/expo/modules/audio/AudioRecorder.kt
@@ -85,10 +85,6 @@ class AudioRecorder(
       throw AudioRecorderAlreadyPreparedException()
     }

-    if (useForegroundService && !hasNotificationPermissions()) {
-      throw NotificationPermissionsException()
-    }
-
     val recordingOptions = options ?: this.options
     val mediaRecorder = createRecorder(recordingOptions)
     recorder = mediaRecorder
@@ -430,14 +426,6 @@ class AudioRecorder(
   private fun hasRecordingPermissions() =
     ContextCompat.checkSelfPermission(context, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED

-  private fun hasNotificationPermissions(): Boolean {
-    // POST_NOTIFICATIONS permission is only required on Android 13+ (API 33+)
-    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
-      return true
-    }
-    return ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED
-  }
-
   fun getAvailableInputs(audioManager: AudioManager) =

NotificationPermissionsException would then be unused. The docs for allowsBackgroundRecording could say that notification permission only controls whether the notice shows in the drawer.

The impact was real for us. Everyone who declined the notification prompt at first launch, which is a common choice, silently lost the ability to record. We found it when a customer reported it; about 10 more Android users showed the same pattern over 30 days.

Environment

  expo-env-info 2.1.0 environment info:
    System:
      OS: Linux 6.6 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
      Shell: 5.2.21 - /bin/bash
    Binaries:
      Node: 24.13.0 - /home/carles/.nvm/versions/node/v24.13.0/bin/node
      Yarn: 1.22.22 - /home/carles/.nvm/versions/node/v24.13.0/bin/yarn
      npm: 11.6.2 - /home/carles/.nvm/versions/node/v24.13.0/bin/npm
    SDKs:
      Android SDK:
        API Levels: 31, 35, 36
        Build Tools: 34.0.0, 35.0.0, 36.0.0
    npmPackages:
      expo: ~57.0.25 => 57.0.25
      react: 19.2.3 => 19.2.3
      react-native: 0.86.3 => 0.86.3
    npmGlobalPackages:
      eas-cli: 20.5.0
    Expo Workflow: managed

Expo Doctor Diagnostics

Running 21 checks on your project...
21/21 checks passed. No issues detected!