protected void onResume() { super.onResume(); if (Build.VERSION.SDK_INT >= 23) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, 1); } } }
其他的权限可以类推,虽然在AndroidManifest.xml中增加了权限,但是,6.0及以上,还是要增加判别