WRITE_EXTERNAL_STORAGE permission is always blocked in React Native android platform – Android

by
Ali Hasan
android android-permissions react-native react-native-permissions reactjs

Quick Fix: In API level 33 (Android 13) onwards, you no longer need to check for WRITE_EXTERNAL_STORAGE permission. Instead, write data to your app’s cache directory if possible.

The Problem:

The WRITE_EXTERNAL_STORAGE permission is not being requested or granted when the app is installed on an Android device, despite adding the necessary permissions to the AndroidManifest.xml file and requesting the permission in the React Native code. The requestPermissions() function always returns ‘blocked’ as the response, indicating that the permission has been restricted or denied.

The Solutions:

Solution 1: Skip WRITE_EXTERNAL_STORAGE permission check for API level 33

In Android 13 (API level 33) and higher, the WRITE_EXTERNAL_STORAGE permission is automatically granted to apps that target that API level or higher. This is because new Android versions have introduced stricter security measures to protect user data.

Therefore, if you are targeting API level 33 or higher, you do not need to check or request the WRITE_EXTERNAL_STORAGE permission. Instead, you should always write data to your app’s internal storage directory, which is secure and does not require permissions.

Q&A

Why storage permission is not working in React Native new version?

API level 33 (Android 13) has introduced restrictions for storage access and provide secure way to access data.

Is there any alternative of WRITE_EXTERNAL_STORAGE permission?

Yes, you can always write your data to app directory only(cache directory).

Video Explanation:

The following video, titled "Manage Write External Storage Permission android 13 | Android 13 ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

No more android.permission.write_external_storage android 13, so need to deal with storage permission with separate ...