@Max I did some debugging and manage to find the possible issue.
So, when the app is already running, everything works perfect, BUT, when the app is closed and the device is locked, the function "func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {" is not called.
I...