requestLegacyExternalStorage flag in the react native app manifest file

Viewed 304
We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs.

Developers with apps on devices running Android 11+ must use Scoped Storage to give users better access control over their device storage. To release your app on Android 11 or newer after May 5th, you must either:

Update your app to use more privacy friendly best practices, such as the Storage Access Framework or Media Store API
Update your app to declare the All files access (MANAGE_EXTERNAL_STORAGE) permission in the manifest file, and complete the All files access permission declaration in Play Console from May 5th
Remove the All files access permission from your app entirely
For apps targeting Android 11, the requestLegacyExternalStorage flag will be ignored. You must use the All files access permission to retain broad access.

Apps requesting access to the All files access permission without a permitted use will be removed from Google Play, and you won't be able to publish updates.

I have received the above message from google. I have updated the reactnative apps manifest file to target api 30 and removed requestLegacyExternalStorage flag and updated manifest file and dependencies as follows .

My manifest file is looks like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.xxx"

  xmlns:tools="http://schemas.android.com/tools"
  >
    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="true"
      android:theme="@style/AppTheme"
      tools:targetApi="30"
      android:usesCleartextTraffic="true" 
      >

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustPan"
        android:screenOrientation="portrait"
        >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_notification" />
   
    </application> 

</manifest>

my dependencies:

 "dependencies": {
    "@flyerhq/react-native-android-uri-path": "1.0.2",
    "@react-native-community/art": "1.2.0",
    "@react-native-community/async-storage": "1.7.1",
    "@react-native-community/datetimepicker": "2.3.0",
    "@react-native-community/masked-view": "0.1.7",
    "@react-native-community/netinfo": "5.3.3",
    "@react-native-firebase/app": "7.0.1",
    "@react-native-firebase/messaging": "7.0.1",
    "@react-navigation/native": "5.0.0",
    "@react-navigation/stack": "5.0.0",
    "@redux-offline/redux-offline": "2.5.2-native.3",
    "formik": "2.1.4",
    "jwt-decode": "3.1.2",
    "lodash.mapvalues": "4.6.0",
    "moment": "2.24.0",
    "native-base": "2.13.8",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-check-version": "1.0.9",
    "react-native-device-info": "5.5.8",
    "react-native-document-picker": "3.5.4",
    "react-native-gesture-handler": "1.5.6",
    "react-native-iphone-x-helper": "1.2.1",
    "react-native-image-picker": "3.5.0",
    "react-native-loading-spinner-overlay": "1.1.0",
    "react-native-modal": "11.5.4",
    "react-native-modal-datetime-picker": "8.5.1",
    "react-native-progress": "4.1.2",
    "react-native-reanimated": "1.7.0",
    "react-native-safe-area-context": "0.7.3",
    "react-native-screens": "2.3.0",
    "react-native-select-two": "1.1.0",
    "react-native-simple-radio-button": "2.7.4",
    "react-native-splash-screen": "3.2.0",
    "redux-devtools-extension": "2.13.8",
    "redux-persist": "6.0.0",
    "redux-persist-filesystem-storage": "3.0.0",
    "rn-fetch-blob": "0.12.0",
    "yup": "0.28.3"
  }

rn-fetch-blob library has following lines in its manifest:

<!-- Required to read and write the expansion files on shared storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

So is this enough to update to android 11 or do I need to replace this rn fetch blob library ?

in the community many discussions are going on . some says if we use the WRITE_EXTERNAL_STORAGE it will automatically remove from the store some other says it is ok to use this permission and we could do declaration in Play Console and all. So how can I tackle this situation?

0 Answers
Related