We are looking to make an application in which a bot answers the call for us and says a predefined text like one sentence or two and the other person on their phone says/tells their work to the bot. Then after the call bot gives a speech to text.
As per my research we can automatically pick call in Android Oreo using android.permission.ANSWER_PHONE_CALLS
But I don't know further steps. Can anyone help me?
Actually this is almost impossible and very unreliable. Most phones don't have access to line audio since it is illegal to record calls in most countries.
This is the reason why most voice recorders can't record incoming audio in a call, at best they use the microphone to capture the audio coming from the speaker and some of them even require the phone to be rooted.
The permission android.permission.ANSWER_PHONE_CALLS only allows you to automatically "Pick up" the phone, but does not give you access to the call audio.
Related
Is there any way to build our own Call screening application(Incoming call answer bot) to transfer the specific audio recording to an incoming call? To do that
The application should answer the call. (There is an official API to answer the phone call in recent versions of Android)
The application should be able to receive the voice.
The application should be able to transmit the recording as an outgoing voice.
Is it possible to do 2,3?
In short - I'd be very surprised if 2 and 3 are possible because of legal issues - it is not legal to record conversations in the US (and other parts of the world, probably) and Google, like Apple, do not allow it. This is the main reason call recording has always been clunky on Android (e.g. forcing the user to use the speaker).
If applications have access to voice calls, there will not be a problem recording them
It gets worse on Android 9 onwards...
I wish to make automated calls to a list of numbers to then play a recorded audio message to them. The ones that don't pick up get a call back later.
What's the cheapest and easiest way to develop this using some pre-existing tools? Any directions welcome.
Note: You can play back the audio data only to the standard output
device. Currently, that is the mobile device speaker or a Bluetooth
headset. You cannot play sound files in the conversation audio during
a call.
from the official docs
I ended up using automated flow apps (Automate [link below] is one such app that I used. Disclaimer: I've no affiliation with app) to trigger automated calls. The flow was initiate on a GCM notification to the phone, which provided the number for call. With all permissions granted and conditions fulfilling (network, sim, call credits, etc.), app should be able to make call to the number.
Now, I'm trying to figure out how to play an audio message for the receiver.
So, if you were looking for 'how' part, here's the how part. If you know the next steps, enlighten me!
https://play.google.com/store/apps/details?id=com.llamalab.automate&hl=en&gl=US
I'm using code from the following URL in order to get sound data from the microphone with AudioRecord:
http://www.dreamincode.net/forums/topic/303235-visualizing-sound-from-the-microphone/
The problem I'm seeing is that if another app is also using the microphone, I'm getting an error (status -3) from AudioRecord. Everything works as expected if I kill the other app which is using the microphone. Is there an elegant solution to allow my app to access the microphone even if another app is already using it?
Thank you.
Sadly, only one app at a time can access the microphone (just like the camera).
Also, there is no standard way to inform another app that you want access to the microphone (so that they release the resources and let you access it). You could however send a broadcast to all other apps ("requesting the microphone"), but the other apps would have to implement this feature (and very few or zero developers will do this).
I would recommend you to simply inform the user that the microphone is currently not available, because you can't do anything else.
If you are using the "OK Google" function with the option to access it from any page, try turning that off (the 'any page' bit From Google app screen MENU>SETTINGS>VOICE>"OK GOOGLE DETECTION">FROM ANY SCREEN=OFF): it hijacks the microphone, or can do.
I have an Android app that happens to be running in the background on the user's Android phone, while the user is speaking on a phone call that someone placed to the user. At a certain point, my app would like to silence the audio from the phone call and play its own audio. Moreover, I'd like to do this without disrupting the user's speech.
What permission does my app need to have, to do this? Is there any permission that's available to third-party apps that is sufficient to let my app do this?
It looks like AudioManager.setStreamMute(STREAM_VOICE_CALL, true) will mute the audio output from the voice call. But I can't tell what permission this needs: it's not listed in the Android API documentation, or in the Pscout permission map. Also, I can't tell if there any restrictions on using this API from an app running in the background, on any version of Android.
(If the problem statement wasn't clear: Alice has installed my app on her phone. Bob calls Alice. Alice picks up the call and is talking to Bob. At a certain point, my app wants to completely mute Bob's voice and play its own audio clip instead, so Alice hears the audio clip instead of anything that Bob says. But, I don't want to turn off the microphone on Alice's phone: if Alice is saying anything, that should still be picked up over the call and Bob should still hear it on the phone call.)
You can try: android.permission.MODIFY_AUDIO_SETTINGS.
I have an Android application that begins recording from the microphone when the application starts. In my current version, the user must press a STOP button to stop recording.
How do I detect that the user has stopped talking and use that to trigger the recorder to stop?
Similar to what is implemented in the Speech Recognition functionality in Android. The user stops talking and then the speech is translated. I have seen other apps that do it, like Talking Tom type apps.
As a side note I would also love to show some type of visual indicating that the microphone is receiving sound. Something to show the sound level coming in.
Any help appreciated.
An approach is to use threads on recording and the speech power analyzing process on the recorded bytes,
there's a sample code for your reference: http://musicg.googlecode.com/files/musicg_android_demo.zip
What are you using to record audio? This may provide some clues:
android.media.MediaRecorder:
the constant MEDIA_RECORDER_INFO_MAX_DURATION_REACHED can be used with an onInfoListener.
android.speech.SpeechRecognizer:
attach a RecognitionListener and call onEndofSpeech().