skip to Main Content

I want to make an Android application that can record both incoming and outgoing calls in the background as a service in kotlin and at a particular time in the day, it sends all that recordings to a server by API. I had researched about it all I found is to use Device Policy Manager and Telephoney Manager but it is not much about it on the internet. So can you help me with any article, documentation, or tutorial?

2

Answers


  1. Chosen as BEST ANSWER

    There is no solution from Google as of now. Google has deprecated the feature of recording the calls in it's latest versions of Android OS. Earlier it was possible, I had tried various methods but I was only getting the silent audio when I had tried to record calls. When using Google's Phone application it only allows that application to use the microphone and other things it won't allow any other application to overpower and get that hardware access.

    But there are actually two hacks to do that.

    1. Build your own phone application like Truecaller and manage every call and other things from that application by doing this you can get access to managing calls on your device and you will also get the access to record the calls.
    2. If your work is specific to any one mobile example like Samsung, OnePlus, etc. Then you can use any Truecaller or Google's Phone application which will store the recordings of the calls in file storage and then you can make a service to upload that call recording from that particular file location every night at 12 AM or something.

  2. first create MyCallRecordReceiver class

        class MyCallRecordReceiver(callRecord: CallRecord) : CallRecordReceiver(callRecord) {
    
    
        override fun onIncomingCallReceived(context: Context, number: String?, start: Date) {
            super.onIncomingCallReceived(context, number, start)
        }
    }
    

    then in MainActivity

    class MainActivity : AppCompatActivity() {
    
    companion object {
        private val TAG = MainActivity::class.java.simpleName
    }
    
    private lateinit var callRecord: CallRecord
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
      
        callRecord = CallRecord.Builder(this)
            .setLogEnable(true)
            .setRecordFileName("CallRecorderTestFile")
            .setRecordDirName("CallRecorderTest")
            .setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION)
            .setShowSeed(true)
            .build()
    
    }
    
    fun StartCallRecordClick(view: View) {
        LogUtils.i(TAG, "StartCallRecordClick")
        callRecord.startCallReceiver()
    
    }
    
    fun StopCallRecordClick(view: View) {
        LogUtils.i(TAG, "StopCallRecordClick")
        callRecord.stopCallReceiver()
    
    }
    }
    

    In addition Add it as a dependency in your app’s build.gradle file

        allprojects {
      repositories {
        maven { url 'https://jitpack.io' }  
      }
    }
    

    and this

    compile 'com.github.aykuttasil:CallRecorder:1.5.3'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search