TheGameCreators / AGK-Studio

3 stars 1 forks source link

'Write External Storage' in manifest no longer accepted by Google Play Store #800

Open KevinCrossDCL opened 3 years ago

KevinCrossDCL commented 3 years ago

This is the message that is shown on Play Console for my app:

Starting May 5th, you must let us know why your app requires broad storage access

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.

That last sentence says that anyone using this permission will find their apps are removed from the store if it's not fixed in time. This is a big issue as you only have 2 and a half weeks to release a fix in Studio before many of us lose our apps in the store.

The tooltip for the Write Storage External in Studio says it's used for Camera, SharedVariables, and raw. I don't use any of these but camera in my app, however I do already have the Camera option ticked too. I tested my app by disabling the Write Storage External option when exporting but then my app no longer has permissions to access the users Gallery, and it's no longer a permission they can pick. My app requires access to their gallery so that they can load images into the app. I can't export with this option off because then that breaks my app, and if I leave it on then it would appear my app will be deleted from the store on the 5th of May. Damned if I do, damned if I don't.

I would imagine there would be other users affected if they use Camera to save to storage, SharedVariables, or raw in their apps.

LynxJSA commented 3 years ago

Received this, as well, on my app that saves high scores but not on my app that saves ringtones. Will poke around on my end for more info on that.

Goldfishapps commented 3 years ago

I have had this warning from the Play store on my App as well. My App has had over 100K downloads and is making me some money so really don't want to lose it over this. When exporting my APK I don't even have the Write Storage External option selected! I always wanted to keep my permissions to a minimum and only select Internet/Network, In app Purchase, Push notifications and vibrate. I don't really have a clue as my app was built all in Tier 1 but I'm guessing it is something that is packaged in the libraries that AGK adds to the exported APK or something that gets added to the manifest file even when the permission is not selected. By only given until the 5th of May they really haven't given long for this problem to be sorted. If anybody has any other information or a fix for this please let me know any help on this would be gratefully received.

PaulSJ commented 3 years ago

This shouldn't cause anyone any problems, but we're looking to put out an update that will remove this warning either this week or next (iOS also requires some changes for iOS 14.5 so we want to get those done at the same time).

The requestLegacyExternalStorage flag is currently present in all AGK apps since it allowed us to continue supporting deprecated functionality in Android 10 to read and write to the device's storage (called external storage from the app's point of view). Android 11 has now deprecated this flag as well.

The presence of this flag does not mean the app is accessing external storage just that it might be, so Google are detecting the flag and warning you that if you are actually accessing external storage then you need to follow some new rules. For this Google have introduced a new permission called MANAGE_EXTERNAL_STORAGE which grants access to all files in external storage in Android 11, this is different from the old WRITE_EXTERNAL_STORAGE permission which we currently use.

Since no AGK apps currently request the MANAGE_EXTERNAL_STORAGE permission you will not be required to explain why they are using it. If you are using the WRITE_EXTERNAL_STORAGE permission in your app then this is ignored by Android 11 and you don't get any access to external storage.

If you want to remove the warning immediately edit the file at "media\data\android\sourceGoogle\AndroidManifest.xml" and remove the code that reads android:requestLegacyExternalStorage="true" be sure to keep the closing angle bracket > at the end of the line. Then export as normal.

To access images on the user's device use ShowChooseImageScreen() instead which will use Android approved methods for a user to select an image.

KevinCrossDCL commented 3 years ago

How do you do this on a Mac? I assume this is something we change in Studio (not the exported APK). If so, the folder structure is slightly different, and the android folder appears empty.

/Applications/AppGameKit Studio 2020.11.12b.app/Contents/Resources/media/data/android

Apparently you can hold Cmd+Shift+. (full stop) to show hidden files but it's not making a difference

Screenshot 2021-05-01 at 11 00 01
PaulSJ commented 3 years ago

@KevinCrossDCL The Mac version has to store the Android export files outside the .app file to avoid Apple signing issues. On my machine the files are stored in "/Users/username/Library/Application Support/AgkStudio/AndroidExport" but this may be different if MacOS decides to sandbox the app in which case the path will be somewhere in "Library/Containers"

As for the AGK update, Apple are being slow to respond to some questions we have about the way iOS 14.5 is behaving so it will take a little longer than expected.