Open anonym24 opened 6 years ago
it doesn't save any audio, I even changed to mic temporary, but still can't find nothing on my sdcard:
public class MainActivity extends AppCompatActivity {
private CallRecord mCallRecord;
private boolean recording;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mCallRecord = new CallRecord.Builder(this)
.setRecordFileName("RecordFileName")
.setRecordDirName("RecordDirName")
.setRecordDirPath(Environment.getExternalStorageDirectory().getPath()) // optional & default value
.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB) // optional & default value
.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB) // optional & default value
.setAudioSource(MediaRecorder.AudioSource.MIC) // optional & default value
.setShowSeed(true) // optional & default value ->Ex: RecordFileName_incoming.amr || RecordFileName_outgoing.amr
.build();
final Button button = findViewById(R.id.start_stop);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (recording) {
mCallRecord.stopCallReceiver();
button.setText("start");
} else {
mCallRecord.startCallReceiver();
button.setText("stop");
}
recording = !recording;
}
});
}
}
I added all permissions:
requestPermissions(new String[]{WRITE_EXTERNAL_STORAGE, RECORD_AUDIO, PROCESS_OUTGOING_CALLS, READ_PHONE_STATE}, 21);
import static android.Manifest.permission.*;
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
and still nothing
go in the settings of the app. and enable the permissions.
go in the settings of the app. and enable the permissions. and still DOESN'T WORK: doesn't respond to buttons
Android 6.0.1