Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

[Android 9.0+] Recording is cut off when app is backgrounded #344

Open
arvindhsukumar opened this issue Sep 20, 2019 · 3 comments
Open

[Android 9.0+] Recording is cut off when app is backgrounded #344

arvindhsukumar opened this issue Sep 20, 2019 · 3 comments

Comments

@arvindhsukumar
Copy link

Version

react-native-audio : 4.3.0
react-native : 0.60.5
react : 16.8.6
using react-native-sound ? No

Expected behaviour :

Tried recording audio on Android 9.0, with the app backgrounded, or device locked. Expected the audio to be recorded properly.

Actual behaviour

The recording gets cut off when the app is backgrounded or device is locked, after about a minute or so. There's only complete silence, while the recording continues to happen.

Steps to reproduce

On an Android 9.0+ device, start recording, and then background the app. The recording gets cut off at around the 1 minute mark. Note that the recording technically continues, and the recorded file has the full duration. It's just that the audio gets cut off.

This seems to be because of changes in Android 9.0:

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.

Referenced here: https://developer.android.com/guide/topics/media/mediarecorder

@arrygoo
Copy link

arrygoo commented Sep 24, 2019

Same issue is happening to me also on iOS 13 :( Was working on previous versions

@arvindhsukumar
Copy link
Author

@arrygoo Does the app crash for you, or does the recording go silent?

@matamicen
Copy link

Hi guys,

First of all thanks the library :)

The same is happening to us on Android and iOS, Android stops after 1 minute of lock screen (background also) and iOS inmediately stops on background, then when the APP come back to foreground the audio restart to recording again without any problem, there is no crashes.

@arrygoo @arvindhsukumar any ideas?

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants