Commit b9c619017d4d8e87bcf95503f2d70ed3cdbb99bd

Anders Jenbo 2021-11-14T23:36:05

[Android] Limit WRITE_EXTERNAL_STORAGE to SDK 22- Direct access to the external storage is no longer allowed as of SDK 30. But on older version of Android you will still need WRITE_EXTERNAL_STORAGE in order to request the Download Manager to download files to your external file folder.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml
index 3093346..30878d2 100644
--- a/android-project/app/src/main/AndroidManifest.xml
+++ b/android-project/app/src/main/AndroidManifest.xml
@@ -38,8 +38,8 @@
         android:name="android.hardware.microphone"
         android:required="false" /> -->
 
-    <!-- Allow writing to external storage -->
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <!-- Allow downloading to external storage -->
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="22" />
     <!-- Allow access to Bluetooth devices -->
     <uses-permission android:name="android.permission.BLUETOOTH" />
     <!-- Allow access to the vibrator -->