Skip to content

[Android 9+] Microphone audio stream ends after 1 min of talk in background #8

@DrSchmurge

Description

@DrSchmurge

On Android 9+, after going to background mode, when being in active call, the stream from microphone is being cut after 1 minute of talking. When moving back to foreground, the stream becomes active again.
My research showed that Android 9+ has this behavior for apps for security reasons.
https://developer.android.com/guide/topics/media/mediarecorder

Note: On devices running Android 9 (API level 28) or higher, apps running in the background cannot access the microphone. Therefore, your app should record audio only when it's in the foreground or when you include an instance of MediaRecorder in a foreground service.

To prevent this, a FOREGROUND SERVICE must be started for a process, that uses a microphone (with static ongoing notification like "this app is using microphone in background. Google Meets, Hangouts and WhatsApp have the same behavior). Have anybody tried this ? How can pjsib be started inside a foreground service? I am new to Java and android architecture in general, so any help will be highly appreciated
Many thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions