Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio stops being captured on Android 12 after hanging up from a phone call #20208

Open
lniepolski opened this issue Nov 24, 2022 · 6 comments
Open

Comments

@lniepolski
Copy link

Summary

I am developing a recording app with expo-av. I've noticed recently that on Android 12 when a user picks up a call, the app keeps recording but when listening to it later, there is silence while the user was on the phone, but also after he hung up till the end of the recording. On older versions of Android, there is silence while the user was on a call, but it starts capturing audio again when he hangs up. Any idea how to fix it, so it keeps recording after a user hangs up (please note, my intention is not to capture the phone call but keep recording after the user hangs up)?

What platform(s) does this occur on?

Android

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 12.4
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.0.1 - /opt/homebrew/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.19.2 - /opt/homebrew/bin/npm
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
npmPackages:
expo: ^45.0.0 => 45.0.8
react: 17.0.2 => 17.0.2
react-dom: 17.0.2 => 17.0.2
react-native: 0.68.2 => 0.68.2
react-native-web: 0.17.7 => 0.17.7
react-navigation: ^4.4.4 => 4.4.4
Expo Workflow: bare

Minimal reproducible example

Here is a simple repo I prepared:
https://github.com/lniepolski/audio-recording-example

Here are the instructions again:

Run the project on Android 12 by running expo start --android
Start recording
Pick up a call or call someone
Hang up
Keep recording for a bit after hanging up
Listen to the recording- there is no audio captured after hanging up

Also note that I use bare workflow and an older version of the expo in my original project, but the result is basically the same.

@lniepolski lniepolski added the needs validation Issue needs to be validated label Nov 24, 2022
@brentvatne
Copy link
Member

can you please try to verify on this on the latest sdk verison, 47?

@brentvatne brentvatne added needs more info To be used when awaiting reporter response and removed needs validation Issue needs to be validated labels Nov 25, 2022
@lniepolski
Copy link
Author

@brentvatne the repo I provided in Minimal Reproducible Example is on SDK 47 and the behavior is the same.

@brentvatne
Copy link
Member

got it, thanks. we likely won't be investigating this any time soon because it's not a high priority for us, but if you would like to dig into it and try to submit a pr that would be welcome. alternatively, if it's high priority for you, you may want to reach out to one of our recommend consultants for help: https://expo.dev/consultants

@brentvatne brentvatne added Issue accepted and removed needs more info To be used when awaiting reporter response labels Nov 25, 2022
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@lniepolski
Copy link
Author

lniepolski commented Dec 2, 2022

I am not 100% sure, but I've changed TARGET_SDK to version 31 (Android 12) and it seems to be working now.

@lniepolski
Copy link
Author

I actually found the solution. It is related to running the service in the background while recording. They key tho, was to add foregroundServiceType to it. So you have to add something like this in your Manifest:

    <service android:name="com.voximplant.foregroundservice.VIForegroundService"
      android:foregroundServiceType="microphone"
      > </service>

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

No branches or pull requests

3 participants