2
Android不顯示RECORD_AUDIOAndroid不顯示權限對話框RECORD_AUDIO在安卓6.0
我已經加入Android清單
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
所需的權限和下面的代碼
private boolean checkPermission() {
int result = ContextCompat.checkSelfPermission(this, android.Manifest.permission.RECORD_AUDIO);
if (result == PackageManager.PERMISSION_GRANTED) {
return true;
} else {
return false;
}
}
private void requestPermission() {
if (ActivityCompat.shouldShowRequestPermissionRationale(this, android.Manifest.permission.RECORD_AUDIO)) {
Toast.makeText(this, "RECORD AUDIO Permission is required.",
Toast.LENGTH_LONG).show();
} else {
ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.RECORD_AUDIO},
PERMISSION_REQUEST_CODE);
}
}
權限對話框
並檢查它
if (!checkPermission()) {
requestPermission();
}
然而對話框詢問許可或屏幕請求許可沒有顯示,
我在模擬器上
請出示您的gradle這個文件 –