Don't allow to create a image file in external storage in react native app (android)

Viewed 15

I am making an application with react native and when I try to create a file in an external storage location I get an error. The error is "never_ask_again", the problem is that it never asks me if I give permissions to the application, it only works in READ_EXTERNAL_STORAGE where it asks me and I give permission and in WRITE_EXTERNAL_STORAGE I do not get the notification to give permission.

I already have the permissions in androidmanifest.xml

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      android:requestLegacyExternalStorage="true">

I am also cheking the read and write permission using the following code:

PermissionsAndroid.check(
  PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
).then(granted => {
  if (!granted) {
    PermissionsAndroid.requestMultiple([
      PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
      PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
    ]).then(result => {
      console.log(result);
    });
  }
});
0 Answers
Related