public boolean isVoicePermission() {//判断麦克风权限
try {
AudioRecord record = new AudioRecord(MediaRecorder.AudioSource.MIC, 22050, AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, AudioRecord.getMinBufferSize(22050, AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT));
record.startRecording();
int recordingState = record.getRecordingState();
if(recordingState == AudioRecord.RECORDSTATE_STOPPED){
return false;
}
record.release();
return true;
} catch (Exception e) {
return false;
}

}

相关文章:

  • 2022-12-23
  • 2022-02-04
  • 2021-06-10
  • 2021-11-18
  • 2021-04-25
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2021-09-26
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案