动态申请权限

private static String[] PERMISSION_AUDIO = {
        android.Manifest.permission.RECORD_AUDIO,
        android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
        android.Manifest.permission.READ_EXTERNAL_STORAGE
};
int permission = android.support.v4.app.ActivityCompat.checkSelfPermission(MainActivity.this, android.Manifest.permission.RECORD_AUDIO);
if (permission != android.content.pm.PackageManager.PERMISSION_GRANTED) {
    android.support.v4.app.ActivityCompat.requestPermissions(MainActivity.this, PERMISSION_AUDIO, 1);
}

  点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注