Skip to content

Fail fast and document downloads on Android 9 and older - #75

Merged
codenameakshay merged 1 commit into
mainfrom
fix/android-legacy-download-permission
Sep 15, 2026
Merged

codenameakshay merged 1 commit into
mainfrom
fix/android-legacy-download-permission

Conversation

@codenameakshay

Copy link
Copy Markdown
Owner

On Android 9 and older, inserting into the shared Pictures collection needs WRITE_EXTERNAL_STORAGE. The plugin deliberately does not declare it, so downloadWallpaper downloaded the whole image and then failed with SecurityException: Permission Denial.

 downloadToMediaStore(url)
+  if SDK < 29 and WRITE_EXTERNAL_STORAGE is not granted
+    log the reason; return false            (nothing downloaded)
   download → validate → MediaStore insert

The README and the Android guide now say what an app that supports those versions must declare (maxSdkVersion="28") and request at runtime. The plugin's own manifest is unchanged.

Verification

On an API 26 emulator:

  • Without the permission: the call fails before downloading, and the log explains why. No MediaStore row is created.
  • With the permission (the host declares and grants it, using a temporary example patch that was not committed): the download succeeds and a MediaStore row is created.

Local CI (format, analyze, tests, pigeon check, Gradle test/lint/assemble, iOS simulator build): pass.

🤖 Generated with Claude Code

On API 28 and older, inserting into MediaStore's shared Pictures
collection needs WRITE_EXTERNAL_STORAGE. The plugin does not declare it
on purpose, so downloadWallpaper downloaded the whole image and then
failed with a SecurityException. It now checks the permission first,
logs why it failed, and returns false without downloading. The README
and Android guide say what a host app supporting those versions must
declare and request.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codenameakshay
codenameakshay merged commit 477f7c3 into main Sep 15, 2026
5 of 6 checks passed
@codenameakshay codenameakshay mentioned this pull request Sep 16, 2026
@codenameakshay
codenameakshay deleted the fix/android-legacy-download-permission branch September 16, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant