简体   繁体   中英

block call recording in android

I want to create application in android which will block call recording.if someone has secretly install call recording app in my phone like virus or something then this app will restrict/prevent all call recording.

so my question is

Is there any way to block call recording?

Thank you in advance.

I think its possible!!! If one android device is running with two different call recording apps, the call will recorded by first app only, which will use the call recording resources in that device, rest of all apps will fail to record, because the resources can be used by one app at a time, its a computation, who will trigger to start using resources will gonna win..it can be your app!!

I'm just giving Idea only, not the perfect solution!!!

Sample code(Not Full code):

       MediaRecorder recorder = new MediaRecorder();

 Log.d(TAG, "RecordService will config MediaRecorder with audiosource: " + audiosource + " audioformat: " + audioformat);
    try {
        // These calls will throw exceptions unless you set the
        // android.permission.RECORD_AUDIO permission for your app
        recorder.reset();
        recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        Log.d(TAG, "set encoder default");
        recorder.setOutputFile(recording.getAbsolutePath());
        Log.d(TAG, "set file: " + recording.getAbsolutePath());
        //recorder.setMaxDuration(msDuration); //1000); // 1 seconds
        //recorder.setMaxFileSize(bytesMax); //1024*1024); // 1KB

        recorder.setOnInfoListener(this);
        recorder.setOnErrorListener(this);

        try {
            recorder.prepare();
        } catch (java.io.IOException e) {
            Log.e(TAG, "RecordService::onStart() IOException attempting recorder.prepare()\n");
            Toast t = Toast.makeText(getApplicationContext(), "CallRecorder was unable to start recording: " + e, Toast.LENGTH_LONG);
            t.show();
            recorder = null;
            return; //return 0; //START_STICKY;
        }
        Log.d(TAG, "recorder.prepare() returned");

        recorder.start();
        isRecording = true;
        Log.i(TAG, "recorder.start() returned");
        //updateNotification(true);

    } catch (java.lang.Exception e) {
        Toast t = Toast.makeText(getApplicationContext(), "CallRecorder was unable to start recording: " + e, Toast.LENGTH_LONG);
        t.show();

        Log.e(TAG, "RecordService::onStart caught unexpected exception", e);
        recorder = null;
    } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM