添加动态授权

if (Build.VERSION.SDK_INT >= 23) {
int REQUEST_CODE_PERMISSION_STORAGE = 100;
String[] permissions = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};

for (String str : permissions) {
if (AddShopCarLLActivity.this.checkSelfPermission(str) != PackageManager.PERMISSION_GRANTED) {
AddShopCarLLActivity.this.requestPermissions(permissions, REQUEST_CODE_PERMISSION_STORAGE);
return;
}
}
}