React Native - Play Store Warning "Starting May 5th you must let us know why your app requires broad storage access"
Asked Answered
T

5

33

I have a react native app which is on play store for some time and recently i received this important notice from play store, stating if i don't fix this my app will be removed from play store.

Can anyone tell me what this is and how to fix it?

Here is the complete message from Play store

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.

my package.json

{
    "@react-native-async-storage/async-storage": "^1.13.4",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/bottom-tabs": "^5.11.8",
    "@react-navigation/drawer": "^5.12.3",
    "@react-navigation/material-bottom-tabs": "^5.3.14",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",
    "axios": "^0.21.1",
    "fuse.js": "^6.4.6",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-device-info": "^8.0.1",
    "react-native-gesture-handler": "^1.10.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-paper": "^4.7.1",
    "react-native-reanimated": "^1.13.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.17.1",
    "react-native-svg": "^12.1.0",
    "react-native-vector-icons": "^8.0.0"
}

And manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.elevel.fromto">

    <uses-permission android:name="android.permission.INTERNET" />

    <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:usesCleartextTraffic="true">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <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" />
    </application>

</manifest>

Also in Play Console under App bundle explorer I found out my app is using following permissions:

  • android.permission.INTERNET
  • com.google.android.c2dm.permission.RECEIVE
  • com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE
Thirzi answered 14/4, 2021 at 20:15 Comment(7)
perhaps you use a library that uses requestLegacyExternalStorage since your manifest looks fineBrakesman
I do not understand exactly which library is causing the problem. My guess was the async storage community version, but it's manifest looked fine. Should i put requestLegacyExternalStorage in my ManifestThirzi
I have same message from play store for my react native application. My manifest also contains android:requestLegacyExternalStorage="true".Eurhythmy
Were you able to fix it?Thirzi
My assumption is that this warning won't be an issue after setting target SDK to Android 11. Then, requestLegacyExternalStorage won't have any effect on Android 11+ devices but only on Android 10 devices which is an allowed use-case by the Android team. After setting target SDK to Android 11, you need to make sure that your plugins continue to work as expected (these should be plugins that save/load files of any sorts).Influential
I'm using React Native .63, it's not advisable to manually change target version. I guess I'll have to update to RN version .64 it have target version as Android 11.Thirzi
Also there seems to be a lengthy discussion here: reddit.com/r/androiddev/comments/mqzls8/…Influential
T
4

I found out that, if we are targeting Android API 29 we need not worry about the warning, just set requestLegacyExternalStorage=true in your app's manifest file.

Although we will have to upgrade to Android API 30 by November.

Thirzi answered 1/5, 2021 at 17:48 Comment(2)
Where do you set the legacy flag to true?Lice
Exactly, this is nothing to worry about. Even if you are targeting 30, requestLegacyExternalStorage=true will be ignored...Hellgrammite
M
1

My understanding that we should be able to fix the problem using this option even when targeting Android 11:

  • 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

Which I think is the way to fix the fact that android:requestLegacyExternalStorage="true" will be ignored on Android 11. While I'm not sure how to declare All files access permission in Play Console. There should be some form where you supposed to specify the reason your app needs this permission. Anyone can see where this form is?

Murray answered 15/4, 2021 at 8:52 Comment(1)
I don't really need to access external storage, is there any way to specify this in manifest?Thirzi
I
1

Not a fix, but there is a thread on Reddit you may be interested in reading. There are reports of people receiving this message, even if they did not enable the requestLegacyExternalStorage flag.

Insistency answered 23/4, 2021 at 4:44 Comment(0)
P
0

It could be that you are using some a RN dependency that is calling to MANAGE_EXTERNAL_STORAGE

example Path Example -> /MyProject/node_modules/rn-fetch-blob/android/src/main/AndroidManifest.xml

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

I had this dependence RNFetchBlob rn-fetch-blob installed even when I was not using it, so you may need to look for a external dependence that is using the WRITE_EXTERNAL_STORAGE or android:requestLegacyExternalStorage="true"

Phare answered 15/4, 2021 at 18:52 Comment(1)
I found <!-- needed for screenshot tests --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> in node-modules folder under react-native/ReactAndroid/androidTest/AndroidManifest.xml and react-native/ReactAndroid/androidTest/buck-runner/AndroidManifest.xmlThirzi
Q
-1

I found out what is causing my merged AndroidManifest.xml to contain android:requestLegacyExternalStorage from the logs located at the following location:

./android/app/build/outputs/logs/manifest-...-report.txt

Just find requestLegacyExternalStorage in the file.

Quadrat answered 16/4, 2021 at 3:41 Comment(1)
In my manifest-merger-release-report.txt I did not found any instance of requestLegacyExternalStorage. Also in Play Console under App Bundle explorer sectionI found out my app is using following permissions android.permission.INTERNET, com.google.android.c2dm.permission.RECEIVE, com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICEThirzi

© 2022 - 2024 — McMap. All rights reserved.