pushtotalk in background mode

When the app is open and the pushtotalk notification is sent to the app the app calls following functions

  1. func incomingPushResult(channelManager: PTChannelManager, channelUUID: UUID, pushPayload: [String : Any]) -> PTPushResult {
    
  2. func channelManager(_ channelManager: PTChannelManager, didActivate audioSession: AVAudioSession) {
    

Once the app goes into background mode only pt 1 function is getting called and not pt 2 function. Could you pls clarify how to resolve this issue. Also i get error sometimes

2023-05-10 07:47:55.655278+0530 bhnonlineazan[674:48861] [connection] nw_read_request_report [C3] Receive failed with error "Socket is not connected"

Replies

The channelManager(_:didActivate:) method will not be called if the AVAudioSession was not able to be activated. This can occur if you have not enabled the Audio Background mode for your app and if you have not already configured your app’s AVAudioSession to include include the playAndRecord mode when the transmission begins. Make sure that you’re doing the following things in your PushToTalk app:

  • Enable the “Audio, AirPlay, and Picture in Picture” and “Push to Talk” background modes in your Xcode project
  • Enable the “Push to Talk” capability in your Xcode project
  • Request or check microphone recording permission when initially setting up the app during launch and not each time you record
  • Set the AVAudioSession category to playAndRecord during initial app start up and do not change it during the recording process. Changing the audio category during the recording process introduces significant delay.
  • We recommend the use of the AVAudioEngine API for the best recording performance