0

I am building an application for Android with a custom manifest to ask for permissions to access files from the Downloads folder. The last build did work for a few days but as soon as the tablets upgraded to Android 13, the permissions prompt changed from asking for Files to asking for Medias (see picture here).

Below is my custom manifest:

<?xml version="1.0" encoding="utf-8"?>
<!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player"
    xmlns:tools="http://schemas.android.com/tools">
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <application android:requestLegacyExternalStorage="true">
        <activity android:name="com.unity3d.player.UnityPlayerActivity"
                  android:theme="@style/UnityThemeSelector">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        </activity>
    </application>
</manifest>

I have followed this tutorial and the issue still persists.

So my question is how can I get back to having access to files (not medias) from downloads folder ?

Thank you very much in advance, I look forward to reading your ideas :)

Bye !

Unity version: 2020.3.48f1

Tablet: Galaxy tab A

Android version: 13

PaulineB
  • 11
  • 2
  • Your app can create files in Download folder without any permission since sdk 33. And is also able to read those files. – blackapps Aug 08 '23 at 13:36
  • If you want access to files of other apps use SAF: ACTION_OPEN_DOCUMENT. – blackapps Aug 08 '23 at 13:37
  • I am only trying to read .gz files from Download. That's what I read too but when I browse, I get an empty Download repository. – PaulineB Aug 08 '23 at 13:40
  • And about that SAF, is there a way to use it with Unity ? Thank you for your help, I really appreciate it – PaulineB Aug 08 '23 at 13:40
  • Please read my comments. Its not about the type of files i spoke. But about the owner of the file. – blackapps Aug 08 '23 at 13:41
  • I do understand. I just wanted to be more precise as it seems Android handles files and medias differently (is that right ?). So from my understanding .gz (or any other format) will be handled differently than let's say .mp4. Now I have read a lot of things about SAF but it seems to be exclusive to native development. Again, is that correct ? – PaulineB Aug 08 '23 at 13:46
  • The files I am trying to access are manually placed in the download folder from a computer but if the issue is ownership, how can I solve it ? – PaulineB Aug 08 '23 at 13:47
  • You have to use SAF and i do not use unity so i dont know how to implement it. – blackapps Aug 08 '23 at 14:18
  • Yes I think that is the issue. If you follow this link (https://forum.unity.com/threads/android-10-and-scoped-storage-missed-features-in-unity-2019.749333/) and look at yasirkula's answer, it seems like Unity doesn't support SAF – PaulineB Aug 08 '23 at 14:55

1 Answers1

0

Finally found out the solution. After the last Android update, you have to go under: Settings > Security and Privacy > Privacy > Permission manager > Files > See more apps that can access all files and then activate your app. It is a bit of a struggle but at least it is working

PaulineB
  • 11
  • 2