Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

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

Discussion in 'Android' started by protopop, May 6, 2021.

  1. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,550
    Google play sent me this message and im wondering how can I achieve this within Unity - im on Unity 2019 LTS

    Screen Shot 2021-05-06 at 1.19.45 PM.png

    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.
     
  2. kaarloew

    kaarloew

    Joined:
    Nov 1, 2018
    Posts:
    360
    If you haven't manually added the flag to your AndroidManifest.xml file, then you have a plugin in your project that adds the flag.
     
    protopop likes this.
  3. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,550
    This helps me understand what is happening - thank you

    I use The Native Gallery open source plugin to save screenshots in my game. After reading your post I went to the update notes and found this:

    Added android:requestLegacyExternalStorage="true" to AndroidManifest to fix the mysterious UnauthorizedAccessException on Android 10

    I am guessing the problem has to do with this. I am not sure how to fix this though.

    i am going to start by looking on the google play console and seeing if there is a place to declare that I'm using this plugin only for saving screenshots and if that is enough.

    But I am wondering how can I test if I meet the new requirements if I choose to edit the code instead. Is srrring this flag to false enough? Do I need to build and submit my game again to find out if this warning is cleared?
    Or I notice when I start my game first time it asks me for broad media permission. Maybe if I edit then build and that pop up doesn't show up it means the game is ok?

    C2D9C8B3-DF30-4E4E-83CC-ADFCC661219F.jpeg
     
  4. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,550
  5. clueduppstephen

    clueduppstephen

    Joined:
    Aug 6, 2019
    Posts:
    12
    We only just got this warning, so here is what I managed to find out today.

    The May 5th deadline is only for apps already targeting API 30 and using All files access permission (MANAGE_EXTERNAL_STORAGE) (A permission introduced in API 30). The reason for showing the warning for people using requestLegacyExternalStorage flag is not clear to me at this point. The consensus seems to be the legacy flag will simply be ignored in API 30+

    Here are some interesting links that helped us understand what is happening:
    (Reddit discussion) Includes some examples of Google support responses.
    (Unity Native Gallery GIT) A good source from a plugin developer that uses the legacy flag to fix issues introduced in API 29.
     
    protopop likes this.