I'm currently working on a project where I need to record VOIP Calls for apps like (Whatsapp and other app that uses VOIP for calling)
I have tried below code for triggering an event when whatsapp call is made so at the same time I have started audio recorder but here is the problem
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
//i have tried VOICE_COMMUNICATION , VOICE_CALL but same issue
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(file);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
recorder.prepare();
recorder.start();
checkRecording = true;
Log.e("Audio", "recording starts") ;
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
Log.e("Audio", "recording stops") ;
recorder.stop();
checkRecording = false;
}
}, 60000);
} catch (IllegalStateException e) {
e.printStackTrace();
Log.e("Audio stop", "error "+e) ;
}
When audio recording starts and same time whatsapp call then receiver cannot listen to my voice but i can hear his voice and audio recorded only my voice - basically when recording starts it uses same audio source as whatsapp so then whatsapp block mic thats why reciever cant hear my voice
I need a way to use same audio source with multiple app so when I start recording it should not busy mic so whatsapp can also use it?
So, anyone can help to record call over voip (Android studio) or guide me where Im doing it wrong or any suggestion would help me!
And I'm making this app for Emulator which is rooted so any kernal way for this also entertain
and this question already been asked but never answered so please
anyone answer or suggest any solution to this issue
VoIP calls cannot be recorded as of now in Android.
Normal Calls dont use microphone so another app can acquire microphone and record the conversation.
But in VoIP calls, the app would be using the microphone so another app cannot acquire, if it tries it fails with an error. If the app tries to acquire microphone before the VoIP call then during the call the other side will not be able to hear anything.
So bottom line is there is no such app as of now to record VoIP calls in Android.
Cube call recorder or any spy app claiming to record VoIP calls won't record on majority of the phones (even if rooted). They might work on some Chinese phones which might be having dual microphone.
Related
As soon as I receive a push notification from my app I want to trigger the KeyguardManager to launch the fingerprint/pass code screen to open the phone from lock screen so that person can enter the phone and unlock the device.
I want to trigger this programmatically similar to when we click on any notification from lock screen we get the fingerprint/pass-code screen.
I did a lot of RnD but didn't find any solution, this is one of the challenging use case task given to me in class, I have been exploring a lot from quite few weeks with no success at all.
Did tried Broadcast receiver with BiometricManager and many things with no success, any lead will be very helpful.
As soon as you receive push message, onNotificationReceived() (or some other method if you use some 3rd party libs) method gets called as below. from there, you can launch your Main screen where you have written biometric/unlocking code.
class MyReceiver : PushReceiver {
override fun onNotificationReceived(message: Message) : Boolean {
//Launch your MainActivity where you can show Unlock screen.
return super.onNotificationReceived(message);
}
}
I have voice recognition code that crashes upon launch (after the splashscreen). My app works great without voice recognition, but it is required for this app that I have it.
This Acer Chromebook 10 outside of my development has no issue with voice recognition (Okay Google, what time is it... etc.)
Here is a partial screenshot of the error I am getting from logcat on the Chromebook:
I have added permissions in the manifest (before I added this it worked on the Pixel 2XL):
<addPermission android:name="android.permission.BIND_VOICE_INTERACTION"/>
... but still get the same error. I am not launching a competing service, but rather a thread runnable activity. Here is a snippet of the code that I think that may be throwing this error (it crashes right after the splash screen so I don't even get the catch response):
try
{
_activity.runOnUiThread(new Runnable()
{
public void run()
{
// I don't know why, but we have to destroy and redo the recognizer after a failure (unlike onResult), then works great.
mSpeechRecognizer.destroy();
mSpeechRecognizer.setRecognitionListener(recognitionListener);
mSpeechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, "en-US");
mSpeechRecognizer.startListening(mSpeechRecognizerIntent);
}
});
} // end of try
catch (Exception e)
{
Log.debug("Recognition failed with exception " + e.getMessage());
}
Some background - like the title says this code is working with Pixel 2XL. It is part of an in-house plugin that I've written for the Unreal Engine to support voice recognition. As such I test for the permission "android.permission.BIND_VOICE_INTERACTION" in Blueprints (a flowchart-like language for UE4) when running the code on my Pixel and it comes back true - so I know this permission is okay with the Pixel 2XL.
I get the impression that there may be a competing service causing conflict on the Chromebook specifically (ArcVoiceInteractionService?) and if this is so, I need to find out how to get around it.
I'm developing an Android app (Android 5.1) for playing the video stream from IP camera using the RTSP protocol.
I receive and display video stream using the Android VideoView's standard methods:
videoView.setVideoURI(Uri.parse("rtsp://192.168.1.13:8888/test"));
try {
videoView.start();
}
catch (Exception ex) {
ex.printStackTrace();
}
Everything works fine, but the connection to the camera takes too long.
It takes about 5-7 seconds (too long for my needs) before video starts playing.
Is there any way to speed up the connection time?
Finally found a solution.
The problem was that Android' MediaPlayer, that is a part of VideoView, has fixed buffer size that cannot be changed.
So i used Google' ExoPlayer, which provides such feature.
Making buffer size smaller resolved my problem.
P.S.
Maintaining the resource/connection with VideoView.suspend() or VideoView.pause() to resume stream later doesn't make a thing.
I'm trying to write a program that will send MIDI messages to external synthesizers. It does work when using the default synth in Java (1.8 on a mac) and makes a nice ping sound every second when connected to the default synthesizer in Java. As expected this is a boring sound, but it does verify that I'm able to make short midi sequences that are interpreted as sounds by a synth.
I then try to route that signal to an IAC device, so that it can be picked up by other programs (including synthesizers) that can make interesting sounds. However, it seems that none of the events I produce are actually picked up by the IAC device. It doesn't seem like they are sent outside of the JVM, or if they are they are somehow dropped.
My question is simply: Has anyone done this, and can they tell me what they did?
In essence my code does this:
final MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
for (int i = 0; i < infos.length; i++) {
final MidiDevice device = MidiSystem.getMidiDevice(infos[i]);
final String deviceInfo = device.getDeviceInfo().getName();
// My IAC device is called "Bus 1"
if ("Bus 1".equals(deviceInfo)) {
Receiver rcvr = device.getReceiver()
ShortMessage myMsg = new ShortMessage();
// Start playing the note Middle C (60),
// moderately loud (velocity = 93).
myMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, 93);
rcvr.send(myMsg, timeStamp);
}
}
I the test this by connecting the IAC device to an MS-20 soft synth, no sounds are produced. I then connect a "MockMidi" keyboard up to the "Bus 1" IAC device, and I can then play the MS-20 bus. I then try to hook the MockMidi keyboard up to the Bus 1 as an input device, but I don't see any events.
Looks straightforward, but as far as I can tell, no midi messages are ever received at the IAC device when sent from Java, yet the mechanism seems to be working fine both inside java, and outside Java.
I'm stuck, all help will be highly appreciated (and source code will be shared on github when it works (sending to IAC would count as working)). :-)
The documentation for getReceiver() says:
Obtaining a Receiver with this method does not open the device. To be able to use the device, it has to be opened explicitly by calling open().
There is a need to use the built in device camera flash as a torch.
Unfortunately I don't have access to an Android device so I can only use the Android emulator.
How can I validate that my code does work?
I have been trying several times to update my app with different ways to access the camera flash and each time the app was crashed.
My app minimum OS version is 2.2,
At the moment I'm using the following code
private void turnFlashOn() {
camera = Camera.open();
Parameters p = camera.getParameters();
p.setFlashMode(Parameters.FLASH_MODE_TORCH);
camera.setParameters(p);
camera.startPreview();
}
private void turnFlashOff() {
camera = Camera.open();
Parameters p = camera.getParameters();
p.setFlashMode(Parameters.FLASH_MODE_OFF);
camera.setParameters(p);
camera.stopPreview();
}
Haven't tested it yet.
What is your way to use the camera flash?
Thanks!
The first two errors here is that you have called Camera.open() twice and never close it. You need to open it in onResume() and close it in onPause(), and in between operate on the Camera handle you obtained.
You can debug on emulator and mock camera class (with jmockit) , but you will have to be careful - not every camera on real devices supports torch mode ( or have a flash at all) - so you will have to check whether camera object supports this.
Once you got your code working correclty, you will still have to test it on real device
( hint: you can recruit testers on android developers mailing lists if you ask politely and provide signed APK somewhere on the web so people can install it )