Skip to content

[BUG] Google Pixel - Bluetooth Permissions Required with enableDeviceDetection: false #294

Description

@aakritil

Environment

  • expo-audio-studio version: 2.15.0
  • Expo SDK version: 52.0.27
  • Platform & OS version: Android 16
  • Device: Google Pixel 6a

Description

We are using the useAudioRecorder hook for recording on our app. Even though we have set enableDeviceDetection to false, specifically on the phone and platform listed above, we are unable to record due to a loss of Bluetooth Connection permissions on the Android app. We should not be checking for bluetooth devices if enableDeviceDetection is false. This is a very integral issue as any of our users that are on Android/Google Pixel are completely unable to use this service once they have updated their phone.

Configuration

The settings we have set are as follows:

[ '@siteed/expo-audio-studio', { enablePhoneStateHandling: false, enableNotifications: false, enableBackgroundAudio: true, enableDeviceDetection: false, iosBackgroundModes: { useProcessing: true, }, backgroundProcessingTitle: 'Transcribing patient encounter', microphoneUserPermission: 'We need access to your microphone to transcribe patient encounters.', }, ],

const { startRecording, stopRecording, isPaused: isInterrupted, } = useAudioRecorder();

`
      interval: 500,
      sampleRate: SAMPLE_RATE,
      channels: CHANNELS,
      onAudioStream: audioDataCallback,
      encoding: EXPO_AUDIO_ENCODING,
      keepAwake: true,
      autoResumeAfterInterruption: true,
      deviceDisconnectionBehavior: 'fallback',

      // don't actually save any files, everything happens through streaming
      output: {
        primary: {
          enabled: false,
        },
        compressed: {
          enabled: false,
        },
      },`

Logs

2025-10-02 20:08:26.826 29034-29034 jni_lib_merge           com.openevidence                    com.openevidence                     D  Preparing to register libhermesinstancejni_so.  onload_func: 0x6f01ba7294
2025-10-02 20:08:26.826 29034-29034 jni_lib_merge           com.openevidence                    com.openevidence                     D  Preparing to register libjsijniprofiler_so.  onload_func: 0x6f01ba7950
2025-10-02 20:08:26.826 29034-29034 jni_lib_merge           com.openevidence                    com.openevidence                     D  About to register 3 actual methods.
2025-10-02 20:08:26.826 29034-29034 SoLoader                com.openevidence                    com.openevidence                     W  SoLoader already initialized
2025-10-02 20:08:26.835 29034-29078 ExpoAudioS...reamModule com.openevidence                    com.openevidence                     D  Phone state handling disabled based on manifest permissions
2025-10-02 20:08:26.835 29034-29078 ExpoAudioS...reamModule com.openevidence                    com.openevidence                     D  Notification handling disabled based on manifest permissions
2025-10-02 20:08:26.835 29034-29078 ExpoAudioS...reamModule com.openevidence                    com.openevidence                     D  Background audio handling enabled based on manifest permissions
2025-10-02 20:08:26.835 29034-29078 ExpoAudioS...reamModule com.openevidence                    com.openevidence                     D  Device detection disabled based on manifest permissions
2025-10-02 20:08:26.835 29034-29078 ExpoAudioS...reamModule com.openevidence                    com.openevidence                     D  🔧 Initializing AudioDeviceManager...
2025-10-02 20:08:26.835 29034-29078 ExpoAudioS...reamModule com.openevidence                    com.openevidence                     D  🔧 Device detection enabled: false
2025-10-02 20:08:26.836 29034-29078 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  Started monitoring device changes
2025-10-02 20:08:26.836 29034-29078 ExpoAudioS...reamModule com.openevidence                    com.openevidence                     D  🔧 AudioDeviceManager initialized
2025-10-02 20:08:26.840 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  Device connectivity changed: android.media.ACTION_SCO_AUDIO_STATE_UPDATED
2025-10-02 20:08:26.840 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  --- Current Audio State ---
2025-10-02 20:08:26.841 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  BluetoothScoOn: false
2025-10-02 20:08:26.841 29034-29034 AudioSystem             com.openevidence                    com.openevidence                     D  onNewService: media.audio_policy service obtained 0xb4000070ae0fb510
2025-10-02 20:08:26.841 29034-29034 AudioSystem             com.openevidence                    com.openevidence                     D  getService: checking for service media.audio_policy: 0xb4000070ae0fb510
2025-10-02 20:08:26.842 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  WiredHeadsetOn: false
2025-10-02 20:08:26.847 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     E  Error checking Bluetooth headset connection: Need android.permission.BLUETOOTH_CONNECT permission for android.content.AttributionSource@a109473f: BluetoothAdapterServiceBinder.getProfileConnectionState()
                                                                                                                                        java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission for android.content.AttributionSource@a109473f: BluetoothAdapterServiceBinder.getProfileConnectionState()
                                                                                                                                        	at android.os.Parcel.createExceptionOrNull(Parcel.java:3355)
                                                                                                                                        	at android.os.Parcel.createException(Parcel.java:3339)
                                                                                                                                        	at android.os.Parcel.readException(Parcel.java:3322)
                                                                                                                                        	at android.os.Parcel.readException(Parcel.java:3264)
                                                                                                                                        	at android.bluetooth.IBluetooth$Stub$Proxy.getProfileConnectionState(IBluetooth.java:2607)
                                                                                                                                        	at android.bluetooth.BluetoothAdapter$5.apply(BluetoothAdapter.java:2910)
                                                                                                                                        	at android.bluetooth.BluetoothAdapter$5.apply(BluetoothAdapter.java:2900)
                                                                                                                                        	at android.app.PropertyInvalidatedCache.recompute(PropertyInvalidatedCache.java:1657)
                                                                                                                                        	at android.app.PropertyInvalidatedCache.query(PropertyInvalidatedCache.java:1809)
                                                                                                                                        	at android.os.IpcDataCache.query(IpcDataCache.java:371)
                                                                                                                                        	at android.bluetooth.BluetoothAdapter.getProfileConnectionState(BluetoothAdapter.java:2959)
                                                                                                                                        	at net.siteed.audiostream.AudioDeviceManager.isBluetoothHeadsetConnected(AudioDeviceManager.kt:1060)
                                                                                                                                        	at net.siteed.audiostream.AudioDeviceManager.logAudioState(AudioDeviceManager.kt:1593)
                                                                                                                                        	at net.siteed.audiostream.AudioDeviceManager$startMonitoringDeviceChanges$1.onReceive(AudioDeviceManager.kt:1134)
                                                                                                                                        	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1845)
                                                                                                                                        	at android.app.LoadedApk$ReceiverDispatcher$Args.$r8$lambda$mcNAAl1SQ4MyJPyDg8TJ2x2h0Rk(Unknown Source:0)
                                                                                                                                        	at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                                                        	at android.os.Handler.handleCallback(Handler.java:1041)
                                                                                                                                        	at android.os.Handler.dispatchMessage(Handler.java:103)
                                                                                                                                        	at android.os.Looper.dispatchMessage(Looper.java:315)
                                                                                                                                        	at android.os.Looper.loopOnce(Looper.java:251)
                                                                                                                                        	at android.os.Looper.loop(Looper.java:349)
                                                                                                                                        	at android.app.ActivityThread.main(ActivityThread.java:9041)
                                                                                                                                        	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                                                        	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
                                                                                                                                        	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
2025-10-02 20:08:26.847 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  BluetoothHeadsetConnected: false
2025-10-02 20:08:26.847 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  LastSelectedDeviceId: null
2025-10-02 20:08:26.847 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  Available input devices: 5
2025-10-02 20:08:26.847 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D  Device 0: Pixel 6 (HD Audio Internal) (ID: 21, Type: builtin_mic, IsSource: true)
2025-10-02 20:08:26.847 29034-29034 ExpoAudioS...iceManager com.openevidence                    com.openevidence                     D    Address: bottom

Expected Behavior

The recorder should start.

Actual Behavior

The package tried to look for a connected bluetooth headset and since it doesn't have the permissions (which it does not need generally), it errors out and recording never starts.

Additional Context

Seems to be device specific.

Checklist

  • I have updated to the latest version of expo-audio-studio
  • I have checked the documentation
  • I have tested in the official AudioPlayground app
  • I have verified microphone permissions are properly set up
  • I have filled out all required fields in this template

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions