Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 11 new policy "MANAGE_EXTERNAL_STORAGE" #998

Open
cerdonmez opened this issue Apr 19, 2021 · 22 comments
Open

Android 11 new policy "MANAGE_EXTERNAL_STORAGE" #998

cerdonmez opened this issue Apr 19, 2021 · 22 comments

Comments

@cerdonmez
Copy link

Google App Store send me a message as below. What should we do about it?

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.

@imranMnts
Copy link

Do we have any update on that, please?

Currently, react-native-fs is using deprecated android permission which will be rejected by Google in the future.

@tolgaerdonmez
Copy link

there's an older issue also about this, but no one seems to be helping #926

@nikoloz110
Copy link

from what I have researched as long as apps target sdk is set to 29 or less, we should be good, but nonetheless, this issue needs to be addressed sooner or later

@JowelTisso
Copy link

I guess using the Storage Access Framework or Media Store API will do the work... which is tricky to implement...? and I also need help in?

@guofoo
Copy link

guofoo commented May 7, 2021

I looked through a few pages of opens issues to tie back the related issues caused by the upgraded Scoped Storage changes in Android 11. If you see other, older ones, please feel free to reference them back to this single issue so it's easier for everyone to track.

@gabrielporcher
Copy link

While we are targeting Sdk29, this lib is working well.
But, after august 2021, we will have to target sdk 30 to be accepted in google play store.

I tried to implement the new Scopped method, but seems that react-native-fs doesnt support it (withtout the android:requestLegacyExternalStorage="true").

There is something that we can do, to accept tagertSdk30?
Or should this lib be updated?

@thuynt99
Copy link

thuynt99 commented Jul 6, 2021

Have any solution?

@jihokim2
Copy link

Does anyone have solution? I think it is very important issue for android.

@gabrielporcher
Copy link

I dont think that we have any solution yet.
But sure, it its VERY importante, because new apps will cannot use this lib anymore next week.

@jihokim2
Copy link

Any update?

@malgorzatatanska
Copy link

Anything new here? has anyone found a solution?

@tusharaddeveloper
Copy link

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

instead of MANAGE_STORAGE

Use below code to save file No need allow any storage permission in > Q for the same:

if (SDK_INT >= Build.VERSION_CODES.Q) { ContentResolver resolver = context.getContentResolver(); ContentValues contentValues = new ContentValues(); contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, fileName); contentValues.put(MediaStore.MediaColumns.MIME_TYPE, "video/mp4"); contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, dir); Uri videoUri = resolver.insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, contentValues); OutputStream output = resolver.openOutputStream(videoUri); output.write(data, 0, count); output.close(); }

@iqbalprasas
Copy link

You need to add additional permission called MANAGE_EXTERNAL_STORAGE, you can see in this post

https://stackoverflow.com/a/69820147/10851423

@naudej
Copy link

naudej commented Nov 4, 2021

Hi, any updates how to fix this? We need to target Android 11 in order to deploy an update to Play store, is there any work around for targetSdkVersion = 30?

@vindeolal
Copy link

Hi, any workaround or updates on this? We are using targetSdkVersion 30 and are not able to copy or move files from an external location.

@brunofariasd
Copy link

Any update ?

@iqbalprasas
Copy link

#1053

@Hassan-jr
Copy link

Any work around about this issue.
I am trying to access "Manage all file access" but cant.

@guofoo
Copy link

guofoo commented Aug 1, 2022

After not able to proceed, I've given up and moved on to expo-file-manager package to be able to do I what I needed to do.
However, that'll introduce a whole other can of worms to waddle through. Things don't come easy.

@alejandrosazo
Copy link

@guofoo did you switch to the expo-file-manager library?? Is it better than expo-file-system? Or was a solution found with this library?

@Hassan-jr
Copy link

I solved this issue for all React Native developers. I published an NPM package called react-native-manage-external-storage that you can use it to access all files in an android phone.

Here is a link checkout https://www.npmjs.com/package/react-native-manage-external-storage

@leonredfish
Copy link

I simplified @Hassan-jr 's package to make development easier and without strange problems. I also published an NPM package called react-native-external-storage-permissions that you can use it to access all files in an android phone.

Here is a link checkout https://www.npmjs.com/package/react-native-external-storage-permission

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests