From 7ef572818e98bf84af3f23a395750530b73ee2b1 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Wed, 3 Apr 2024 15:41:57 -0400 Subject: [PATCH] android: show local files on older devices --- android/app/src/main/AndroidManifest.xml | 1 + .../java/gallery/memories/service/ImageService.kt | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7afd29095..06032e3a4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -18,6 +18,7 @@ android:supportsRtl="true" android:theme="@style/Theme.Memories" android:usesCleartextTraffic="true" + android:requestLegacyExternalStorage="true" tools:targetApi="31"> = Build.VERSION_CODES.Q) { + val sysImgs = SystemImage.getByIds(mCtx, listOf(id)) + if (sysImgs.isEmpty()) { + throw Exception("Image not found") + } + + val uri = sysImgs[0].uri + mCtx.contentResolver.loadThumbnail( - ContentUris.withAppendedId( - MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL), - id - ), + uri, android.util.Size(2048, 2048), null )