Android server stops when put in background on a Xiaomi device

My mobile device is redmi k40 and android 11

Use scenario: Android is used as the server and windows10 10 is used as the player. The Android application is streamed to windows10 10 and the audiorelay is switched to the background. At this time, windows10 10 prompts that the connection is interrupted and reconnecting is in progress. However, after the source is switched to the microphone, the audiorelay can be switched to the background. Windows 10 does not prompt to disconnect

Please help me fix this problem

When you say

the source is switched to the microphone

I’m assuming that previously, you were using the Apps source.

If I understood correctly, switching to another app after starting a server from the Apps source gets AudioRelay or the connection killed.
But, this doesn’t occur when starting with the Microphone source…

Could you please try to follow the recommendations from this site?

If it doesn’t help, we’ll need to know more.
Could you please try to get some logs from you phone?

The Android app doesn’t store log messages itself so using ADB is necessary.
You would need to do these steps:

  • Get ADB and enable USB debugging
  • Open a terminal
  • Confirm that your device is available via the command adb devices
  • Type adb logcat --clear to remove all the previous logs
  • Type adb logcat > logcat-output.txt to write the new logs to a file
  • In the Android App, start a server with the Apps source
  • Connect your PC to the app
  • Switch the app to the background
  • Wait until the desktop is trying to reconnect
  • In the terminal, stop the log collection by doing CTRL C
  • Post the logcat-output.txt file here