React Native android permission is not showing

Viewed 107

The react native android permission pop-up is not showing, I cannot download a file. It works on a simulator but not on a real phone.

Here is my permission function :

const requestAndroidStoragePermission = async () => {
      try {
        const granted = await PermissionsAndroid.request(
          PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
          {
            title: "File access",
            message:
              "The app needs files access to download your performance.",
          }
        );
        if (granted === PermissionsAndroid.RESULTS.GRANTED) {
          this.setState({ storagePermission: true });
          this.setState({ showExportModal: true });
        } else {
          console.log("Files permission denied");
        }
      } catch (err) {
        console.warn(err);
      }
    };

I have the permission on my AndroidManifest.xml :

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" 
    android:targetSdkVersion="29" />

Someone have an idea ?

0 Answers
Related