Simplest way to make call recording android mobile app

A recording is one of the most useful features in Android mobile phones because with the use of this feature Android application users can easily record their voices as audio notes and play them whenever they want to. So in this tutorial, we are going to Simplest way to make call recording android mobile app. Example Tutorial will work on any Android platform without any error.

Ever wished you had recorded a call? Maybe you got bad customer service from a company over the phone and you want proof. Or, maybe you received training or help that you want to reference again in the future.

There are ways to make call recording Android phone. We will show you an app that records both sides of a conversation on your Android phone with the ability to automatically start when you make or receive a phone call. We’ll also show you an app that allows you to record any sounds outside the phone, allowing you to record both sides of a call.

The Android multimedia framework includes support for capturing and encoding a variety of common audio and video formats. You can use the MediaRecorder APIs if supported by the device hardware.

This document shows you how to use MediaRecorder to write an application that captures audio from a device microphone, save the audio, and play it back (with MediaPlayer). To record video you’ll need to use the device’s camera along with MediaRecorder. This is described in the Camera guide.

To be able to record, your app must tell the user that it will access the device’s audio input. You must include this permission tag in the app’s manifest file:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

Make call recording android mobile app

RECORD_AUDIO is considered a “dangerous” permission because it may pose a risk to the user’s privacy. Starting with Android 6.0 (API level 23) an app that uses a dangerous permission must ask the user for approval at run time. After the user has granted permission, the app should remember and not ask again. The sample code below shows how to implement this behavior using ActivityCompat.requestPermissions().

MediaRecorder recorder;
private boolean startMediaRecorder(final int audioSource){
    recorder = new MediaRecorder();
    try{
        recorder.reset();
        recorder.setAudioSource(audioSource);
        recorder.setAudioSamplingRate(8000);
        recorder.setAudioEncodingBitRate(12200);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        String fileName = audiofile.getAbsolutePath();
        recorder.setOutputFile(fileName);

        MediaRecorder.OnErrorListener errorListener = new MediaRecorder.OnErrorListener() {
            public void onError(MediaRecorder arg0, int arg1, int arg2) {
                Log.e(TAG, "OnErrorListener " + arg1 + "," + arg2);
                terminateAndEraseFile();
            }
        };
        recorder.setOnErrorListener(errorListener);

        MediaRecorder.OnInfoListener infoListener = new MediaRecorder.OnInfoListener() {
            public void onInfo(MediaRecorder arg0, int arg1, int arg2) {
                Log.e(TAG, "OnInfoListener " + arg1 + "," + arg2);
                terminateAndEraseFile();
            }
        };
        recorder.setOnInfoListener(infoListener);


        recorder.prepare();
        // Sometimes prepare takes some time to complete
        Thread.sleep(2000);
        recorder.start();
        isRecordStarted = true;
        return true;
    }catch (Exception e){
        e.getMessage();
        return false;
    }
}

You can define audio source as per the device also. Different devices allow the media recorder for different audio sources.

public static int getAudioSource(String str) {
    if (str.equals("MIC")) {
        return MediaRecorder.AudioSource.MIC;
    }
    else if (str.equals("VOICE_COMMUNICATION")) {
        return MediaRecorder.AudioSource.VOICE_COMMUNICATION;
    }
    else if (str.equals("VOICE_CALL")) {
        return MediaRecorder.AudioSource.VOICE_CALL;
    }
    else if (str.equals("VOICE_DOWNLINK")) {
        return MediaRecorder.AudioSource.VOICE_DOWNLINK;
    }
    else if (str.equals("VOICE_UPLINK")) {
        return MediaRecorder.AudioSource.VOICE_UPLINK;
    }
    else if (str.equals("VOICE_RECOGNITION")) {
        return MediaRecorder.AudioSource.VOICE_RECOGNITION;
    }
    else if (str.equals("CAMCORDER")) {
        return MediaRecorder.AudioSource.CAMCORDER;
    }
    else {
        return MediaRecorder.AudioSource.DEFAULT;
    }
}

NOTE: Recording a phone call without the knowledge of one or both of the parties is illegal in some countries. Some states in the United States require one party to be notified of the recording, some require both parties to be notified. For more information about laws regarding call recording, see Wikipedia and the Digital Media Law Project. Be sure to do your due diligence about the laws in your state before recording any calls.

Conclusion

Jiyo analyses all voice calls in a sales cycle to enhance sales- agent performance and sales conversion ratio. When a salesperson completes a call, call log and the corresponding recording is integrated to the CRM system. The software automatically generates various reports for future analysis of sales agent’s performance. Analysis of call recording android phone helps in improving the sales pitch and product based on customer feedback which leads to higher sales/sales person.

magento-logoJiyo Agent
Jiyo Agent, our native Android app, is a free call recorder application. Calls are automatically recorded and saved to Jiyo. Also all the incoming, outgoing and missed calls details can be viewed inside the app.

References

  • Media Recorder: Media Recorder Documentation for Developers
  • Sales Performance: Sales- agent performance and sales conversion ratio Product pricing and all information

Further reading:

Leave a Comment

Scroll to Top