当应用程序在后台时访问android 9中的麦克风
问题描述:
Android 9 限制了后台应用访问用户输入的能力.如果您的应用在运行 Android 9 的设备上在后台运行,系统会对您的应用应用以下限制:
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.
当应用程序在后台时,有什么方法可以在 android 9 中访问麦克风.
Is there any way to access microphone in android 9 while the app is in the background.
答
One more change was added in Android 9: only apps running in the
foreground (or a foreground service) could capture the audio input.
参考:https://developer.android.com/guide/topics/media/sharing-audio-input#pre-behavior