I'm not getting permission to access full storage, although I added all permission requirements in manifest file. I'm using android 14 version(API 34)

I’m developing an Android application in which I need to add functionality to automatically read a CSV file from a file manager, parse it, and store the data in a database.

I have added all permissions but it says permission denied.

private void requestPermission() {
ActivityCompat.requestPermissions(this, new String{Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_CODE_READ_EXTERNAL_STORAGE);
}

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode == REQUEST_CODE_READ_EXTERNAL_STORAGE) {
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(this, "Permission Denied", Toast.LENGTH_SHORT).show();
        }
    }
}

Starting with Android 14, READ_EXTERNAL_STORAGE is replaced by READ_MEDIA_* for media files. For non-media files, use the Storage Access Framework (SAF) or request MANAGE_EXTERNAL_STORAGE. Add it to your manifest and guide users to enable it via Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION. Note: Google Play restricts MANAGE_EXTERNAL_STORAGE.

1 Like