Search code examples
downloadandroid-11

Download file problems width Android 11, API 29


since two years I have an application width an option to download files from the webserver (href tag width php downlad and readfile() function).

Everything was working fine until Android 11. Now when you select to download a file, nothing happens.

I already has permission on Manifest fil, requestLegacyExternalStorage to true.... see example:

<uses-permission android:maxSdkVersion="28" android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.RECORD_VIDEO"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-feature android:name="android.hardware.location.gps" android:required="true"/> <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:networkSecurityConfig="@xml/network_security_config" android:requestLegacyExternalStorage="true" android:supportsRtl="true" android:usesCleartextTraffic="true">

The funny thing is that if I install the application directly with the debug option (Android Studio) or if I upload it to Google Play in internal test mode (internal trial), it works perfectly, but if I publish it (production) on Google Play it stops working.

Anybody run into this same problem?

I have change the manifest file, the way to upload files, and every time is the same. in debug mode o internal trial you can download the files but when you publish the app you can not.


Solution

  • remove android:maxSdkVersion="28" from this manifest permission.

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"    tools:ignore="ScopedStorage"/>
    

    this will let you to save the files in your storage.