问题
Android 9 limits the ability for background apps to access user input. If your app is running in the background on a device running Android 9, the system applies the following restrictions to your app:
Your app cannot access the microphone or camera.
Is there any way to access microphone in android 9 while the app is in the background.
回答1:
One more change was added in Android 9: only apps running in the
foreground (or a foreground service) could capture the audio input.
Reference: https://developer.android.com/guide/topics/media/sharing-audio-input#pre-behavior
来源:https://stackoverflow.com/questions/63130222/access-microphone-in-android-9-while-the-app-is-in-the-background