首页 > 其他分享 >Android 动态存储权限

Android 动态存储权限

时间:2023-01-17 23:45:05浏览次数:61  
标签:存储 动态 permission STORAGE Manifest EXTERNAL Android 权限

        // 检查外部存储挂载状态
        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
            // 检查读取和写入动态权限
            if (ActivityCompat.checkSelfPermission(ThirdActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {

            } else {
                // 如果没有,获取读取和写入动态权限
                ActivityCompat.requestPermissions(ThirdActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, 100);
            }

        }

https://www.cnblogs.com/zanzg/p/9129375.html

标签:存储,动态,permission,STORAGE,Manifest,EXTERNAL,Android,权限
From: https://www.cnblogs.com/dearnotes/p/16751459.html

相关文章