在 android 中阻止通话录音
block call recording in android
我想在 android 中创建应用程序,它将阻止通话 recording.if 有人在我的 phone 中秘密安装了通话录音应用程序,例如病毒或其他东西,然后此应用程序将 restrict/prevent所有通话录音。
所以我的问题是
有什么方法可以屏蔽通话录音吗?
提前致谢。
我觉得有可能!!!如果一个 android 设备是 运行 两个不同的通话录音应用程序,通话将仅由第一个应用程序录音,这将使用该设备中的通话录音资源,其余所有应用程序将无法录音,因为这些资源一次可以被一个应用程序使用,它是一种计算,谁会触发开始使用资源,谁就会赢……它可以是你的应用程序!!
我只是给出idea而已,不是完美的解决方案!!!
示例代码(非完整代码):
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;
}
我想在 android 中创建应用程序,它将阻止通话 recording.if 有人在我的 phone 中秘密安装了通话录音应用程序,例如病毒或其他东西,然后此应用程序将 restrict/prevent所有通话录音。
所以我的问题是
有什么方法可以屏蔽通话录音吗?
提前致谢。
我觉得有可能!!!如果一个 android 设备是 运行 两个不同的通话录音应用程序,通话将仅由第一个应用程序录音,这将使用该设备中的通话录音资源,其余所有应用程序将无法录音,因为这些资源一次可以被一个应用程序使用,它是一种计算,谁会触发开始使用资源,谁就会赢……它可以是你的应用程序!!
我只是给出idea而已,不是完美的解决方案!!!
示例代码(非完整代码):
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;
}