Symptom
Apps developed using Video API native android SDK are only able to access the microphone in the background for 60 seconds. After 60 seconds, the publisher's audio automatically stops for the android user.
Applies To
- Video API Android SDK
Resolution
As per official android developer docs: https://developer.android.com/guide/topics/media/sharing-audio-input#pre-behavior
"One more change was added in Android 9: only apps running in the foreground (or a foreground service) could capture the audio input. When an app without a foreground service or foreground UI component started to capture, the app continued running but received silence, even if it was the only app capturing audio at the time."
So, when you are using Video API Android SDK, the application developer should launch the foreground service that requests microphone access as below:
<service android:name=".MyForegroundService" android:foregroundServiceType="microphone" />
Make sure you start the service as the app goes in the background and stop the service as the app comes into the foreground or as per your use-case requirement.
Additional Information
Please visit here: https://github.com/dharamvirsaini/BGMicrophoneAccess_Vonage_Video to download the complete source code.
Articles in this section
- How to avoid Gradle build failure with OpenTok Android SDK 2.22.0+
- Why READ_PHONE_STATE permission is required while using Video API Android SDK?
- Where can I get the Vonage Video API Android SDK?
- Inline Installation of Screen Sharing Extensions in Chrome Deprecated
- What devices does the Vonage Video Android SDK support?
- Where can I see the sample code for Vonage Video Android SDK?
- How many participants can join an Android session?
- Running the basic video chat example for Android SDK keeps crashing
- Retaining microphone access in the background using Video API Android SDK
- Screensharing outside Native SDK Application