Start AudioSession from background. Mobile app

I have the Flutter mobile app and I'm using the record flutter package for recording audio. So I'm facing an issue while recording the audio while the phone is locked.

App Behavior:

  1. First we start the app and connect it to a Bluetooth device
  2. Then the app starts looking for the trigger of 1 from the device connected with it.
  3. On receiving the trigger from device it start recording. while mobile locked and app is running in background.

AVAudioSession_iOS.mm:2367 Failed to set category, error: '!int' Failed to set up audio session: Error Domain=NSOSStatusErrorDomain Code=560557684 "(null)"

I'm getting this error when AVAudioSession setting the category. My is for Users security purpose so it need to record background

let me know how can I achive this functionality

Post not yet marked as solved Up vote post of Kashif_tariq Down vote post of Kashif_tariq
647 views