通话记录器应用未记录去电

时间:2019-01-17 10:46:38

标签: android mediarecorder mediarecorder-api

我正在开发一个具有所有权限的应用程序“通话记录器”,但它并未记录来电者的声音。我正在使用MediaRecorder。

void startRecording() {
    final SharedPreferences shared = PreferenceManager.getDefaultSharedPreferences(this);

    int[] ss = new int[]{
            MediaRecorder.AudioSource.VOICE_CALL,
            MediaRecorder.AudioSource.VOICE_COMMUNICATION, // mic source VOIP
            MediaRecorder.AudioSource.VOICE_RECOGNITION,
            MediaRecorder.AudioSource.CAMCORDER,
            MediaRecorder.AudioSource.MIC, // mic
            MediaRecorder.AudioSource.DEFAULT, // mic
            MediaRecorder.AudioSource.UNPROCESSED,
            MediaRecorder.AudioSource.VOICE_UPLINK,
            MediaRecorder.AudioSource.VOICE_DOWNLINK,

    };
    int i = Integer.valueOf(shared.getString(CallApplication.PREFERENCE_SOURCE, "-1"));
    if (i == -1)
        i = 0;
    else
        i = Sound.indexOf(ss, i);

    String ext = shared.getString(CallApplication.PREFERENCE_ENCODING, "");
    if (Storage.isMediaRecorder(ext)) {
        startMediaRecorder(ext, ss, i);
    } else {
        startAudioRecorder(ss, i);
    }

    showNotificationAlarm(true);
}

1 个答案:

答案 0 :(得分:0)

startAudioRecorder(ss, i);

在有记录条件的情况下将此行放入