校验xx权限是否开启



以相机为例,


PackageManager pkm = getPackageManager();
boolean has_permission = (PackageManager.PERMISSION_GRANTED == pkm.checkPermission("android.permission.RECORD_AUDIO", "packageName"));
if (!has_permission) {
    showToast("对不起,没有拍照权限!");
}

你可能感兴趣的:(校验xx权限是否开启)