Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android在Android 6.0中不显示录制_音频的权限对话框_Android_Runtime Permissions - Fatal编程技术网

Android在Android 6.0中不显示录制_音频的权限对话框

Android在Android 6.0中不显示录制_音频的权限对话框,android,runtime-permissions,Android,Runtime Permissions,Android不显示录制\u音频的权限对话框 我已在android清单中添加了所需的权限 <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> 并检查它 if (!checkPermission()) { re

Android不显示录制\u音频的权限对话框

我已在android清单中添加了所需的权限

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
并检查它

if (!checkPermission()) {
                requestPermission();
            }
但是,未显示请求权限的对话框或请求权限的屏幕


我正在一个模拟器上测试android 6.0。如果应该显示消息,showldshowRequestPermissionRegulation()方法只会发出信号。无论其返回值如何,都应请求权限

请看本示例中的第142行:


请出示你的档案
if (!checkPermission()) {
                requestPermission();
            }
/**
 * Requests the Camera permission.
 * If the permission has been denied previously, a SnackBar will prompt the user to grant the
 * permission, otherwise it is requested directly.
 */
private void requestCameraPermission() {
    Log.i(TAG, "CAMERA permission has NOT been granted. Requesting permission.");

    if (ActivityCompat.shouldShowRequestPermissionRationale(this,
            Manifest.permission.CAMERA)) {
        // Provide an additional rationale to the user if the permission was not granted
        // and the user would benefit from additional context for the use of the permission.
        // For example if the user has previously denied the permission.
        Log.i(TAG,
                "Displaying camera permission rationale to provide additional context.");
        Snackbar.make(mLayout, R.string.permission_camera_rationale,
                Snackbar.LENGTH_INDEFINITE)
                .setAction(R.string.ok, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ActivityCompat.requestPermissions(MainActivity.this,
                                new String[]{Manifest.permission.CAMERA},
                                REQUEST_CAMERA);
                    }
                })
                .show();
    } else {

        // Camera permission has not been granted yet. Request it directly.
        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA},
                REQUEST_CAMERA);
    }
}