I'm developing a small Android automation app for a very specific workflow and I'm currently stuck on the audio side.
The app runs on a Samsung Galaxy Z Fold5 (of course it should work for different phones at the end of the day) and automatically calls a cinema's phone number. The cinema has an IVR/answering machine where I can navigate using DTMF tones.
The current workflow already works:
App
↓
Call fixed phone number
↓
Wait using Android post-dial ","
↓
Send DTMF: * → * → * → *
↓
Reach the cinema's voicemail menu
The next step is to automatically understand the spoken announcement, for example:
I want the app to detect the number of new messages and later transcribe the individual messages. Ultimately, the messages contain a first name, phone number, movie, date/time, etc., which I want to extract into an Excel file.
The problem
I can record the phone's normal microphone using:
MediaRecorder.AudioSource.MIC
and I can see the microphone level changing normally.
However, this only captures the phone's microphone. It does not give me the audio coming from the other party in the cellular call.
I also tried enabling the speakerphone programmatically using AudioManager, but on the Galaxy Z Fold5 the call does not switch to speakerphone.
I have also looked into InCallService, but I'm not sure whether there is a way for a normal third-party Android application to access the actual call audio/downlink as PCM data.
What I need
I don't necessarily need to record the call permanently. Ideally, I just need access to the incoming audio while the call is active so I can feed it into speech recognition.
Something like:
Cellular call
↓
Incoming call audio
↓
Audio stream / PCM
↓
Speech-to-text
↓
"7 new messages"
The target device is a Samsung Galaxy Z Fold5, running a current Android version.
I'm aware that Android restricts access to call audio for privacy/security reasons. I'm specifically looking for a legitimate Android API, Telecom API, audio routing method, accessibility approach, or device-specific solution that could make this possible without rooting the phone.
If direct access to the call downlink is fundamentally impossible for a normal Android app, I'd also appreciate confirmation of that and any practical alternatives for this specific use case.