Android 9 : How to get Audio in Background from Call made by phone in my app - android

I have heard a lot about blocking the call recording in android 9. I want to understand is it possible to get audio stream in a background service. Every time a user make a Call. If anyone can help me here what are approach to achieve this like giving notification/asking permission to user for this or building a system app or a plugin or a service. For me Audio stream are required to convert it into speech to text.
i got reference from android documentation for incallService,building a calling App and implementing real time text. I have no idea how to connect these three together to get Audio Stream in background service

Related

Stream an audio from server to my app

I want to stream an audio from the server to Android App. I found some solutions but my scenario is quite different.
I have an audio file which is uploaded to the server, I want to run that audio on a specific time and must be stop after audio complete.
Now let say a user opens his android app to listen an audio after one minute from the start time of that audio than he must listen audio from after one minute of audio running and could not listen that audio from back and forward.
Please guide me the to do it and which technologies should I use?
Would it be better you use Google Firebase or any Realtime server? or simple hosting will be a nice option ?
Thanks

Android add pause RecognizerIntent for speech to text

I have implemented Speech to Text using RecognizerIntent and its working perfectly.
But I need to modify the working of it and want to add pause time while user is speaking, as practically user might stop for a while and then speak again, so I want the voice search to stay for few seconds for example 5 seconds if no voice heard then only it stops and process the speech.
I have tried using services buts its not working as desired. Prefer code examples.
[Implement something similar when I turn on Speech to Text key on Xperia Z3 keyboard, it accepts speech till user taps pause]
Thanks
full duplex example provides your needed feature ( handle pause inline )
This is diff implementation from RecognizerIntent and operates on a more complicated setup for handling mic's audio stream and for handling network connections for processing streams ( audio/UP , text/DOWN ).
So, if you want to use streaming AND continuously recognized speech that goes on until you signal the end of INPUT ( like click event on the mic icon in example ) it can be alot more involved.
background
google API sample
IBM API sample
They are complicated. Either can be implemented on a good , android , httpclient.

Background Audio for a Call in Progress - Possible?

I am writing a android app which is supposed to play back a audio file when a call is in progress coming from a specific number .. I tried many approaches.. but all went in vein
Separate Thread
Listener on Telephone service
starting a service in parallel
can any one please help me how to proceed regarding this ?
Update :
I am able to play a mp3 file on call recieve and i am able to play it load on speaker.. but how ever loud i play the calling party is not able to listen to it.... is there anyway i can push the speaker stream to call stream
From the api doc here
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.
So from this and lots of other so answers we can conclude that we can not play an audio during a call process.
But a long time ago from a personal experience with a handset I got a result where the audiotrack was playing while there was a call established and both the voices were heard at the same time. So I think this depends on handsets if it allows it then you can play.
You can try another thing experimentally. play the audio using a different route ( speakerphone or bluetooth).
Another option is to build your custom android build

reference for doing send audio file by offset android

i am making audio live streaming application. what i was doing before, i recoded voice/audio for certain time and i will push the stop button to stop the recording.
then i put action to send the video after clicking the stop button to server through internet. in here i am using socket programming. it works perfectly however i was not live streaming application.
i have heard about doing the code offset to send the audio file to make it live. it will send bytes by bytes of the audio to the server. however, so far i could not find any reliable tutorial/simple source code of how i would like to do it. does anyone knows where i could fine any reference regarding this method?

Android: How to detect when a user stops talking into the microphone

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().

Categories

Resources