We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
android 11 存储权限问题,在targetSdkVersion >=30 的时候无法创建临时文件导致录音失败, 建议将临时文件路径配置为可自定义,或者为缓存目录
RecordHelper 要改缓存目录为
String fileDir = String.format(Locale.getDefault(), "%s/Record/", this.currentConfig.getRecordDir());
就可以了
/** * 根据当前的时间生成相应的文件名 * 实例 record_20160101_13_15_12 */ private String getTempFilePath() { String fileDir = String.format(Locale.getDefault(), "%s/Record/", this.currentConfig.getRecordDir()); if (!FileUtils.createOrExistsDir(fileDir)) { Logger.e(TAG, "文件夹创建失败:%s", fileDir); } String fileName = String.format(Locale.getDefault(), "record_tmp_%s", FileUtils.getNowString(new SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.SIMPLIFIED_CHINESE))); return String.format(Locale.getDefault(), "%s%s.pcm", fileDir, fileName); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
android 11 存储权限问题,在targetSdkVersion >=30 的时候无法创建临时文件导致录音失败,
建议将临时文件路径配置为可自定义,或者为缓存目录
RecordHelper 要改缓存目录为
String fileDir = String.format(Locale.getDefault(), "%s/Record/", this.currentConfig.getRecordDir());
就可以了
/**
* 根据当前的时间生成相应的文件名
* 实例 record_20160101_13_15_12
*/
private String getTempFilePath() {
String fileDir = String.format(Locale.getDefault(), "%s/Record/", this.currentConfig.getRecordDir());
if (!FileUtils.createOrExistsDir(fileDir)) {
Logger.e(TAG, "文件夹创建失败:%s", fileDir);
}
String fileName = String.format(Locale.getDefault(), "record_tmp_%s", FileUtils.getNowString(new SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.SIMPLIFIED_CHINESE)));
return String.format(Locale.getDefault(), "%s%s.pcm", fileDir, fileName);
}
The text was updated successfully, but these errors were encountered: