0
私が設定している:ストレージ権限を有効にするにはどうすればよいですか?
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
マニフェストに。しかし、アプリはまだ外部ストレージへの書き込みに問題があります。 アプリケーションマネージャを見ると、そのアプリケーションのストレージ権限が間引かれます。それを有効にする方法?なぜ今これが起こっているのですか?それは新しいアンドロイドバージョンのためですか?
if (ContextCompat.checkSelfPermission(sendNotificationActivity.this,Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED)
{
if (!ActivityCompat.shouldShowRequestPermissionRationale(sendNotificationActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(sendNotificationActivity.this);
alertBuilder.setCancelable(true);
alertBuilder.setTitle("Permission necessary");
alertBuilder.setMessage("Storage Permission is needed for sending Image.");
alertBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse("package:" + activity.getPackageName()));
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.startActivity(intent);
}
});
AlertDialog alert = alertBuilder.create();
alert.show();
} else {
ActivityCompat.requestPermissions(sendNotificationActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 541);
}
}
else {
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, 2);
}
}
をそして、これをオーバーライドします:
Settings->Applications->Application Manager-><App name>->Permissions
問題を示すか、それが全てですアンドロイドどのバージョン? –
Marshmallowでテストしている場合は、javaファイルで許可を求める必要があります。 AndroidManifestはMarshmallowデバイスでは無視されます! –
私は6.0.1を使用していますがアンドロイド7と同じですか?マニフェストからの置換を削除する必要がありますか? – user1796624