question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android 10 scoped storage compatibility

See original GitHub issue

Using version 1.0.7 of gallery_saver.

Behavior on an Android 10 device, when using a ‘targetSdkVersion’ of 29:

The albumName parameter is ignored for both images and videos. This is because your implementation of it is not compliant with Android 10’s scoped storage. As per this link, you should be using MediaColumns.RELATIVE_PATH in order to indicate the target folder/album.

It seems that the behavior on Android 10 is to ignore the DATA column that you currently use to indicate the desired path, so images and videos end up within the default locations ‘Pictures’ and ‘Movies’.

Behavior on an Android 10 device, when using a ‘targetSdkVersion’ below 29:

The ‘albumName’ parameter works as intended. Saving videos is working as intended. Saving an image will result in a crash at the point of trying to save its thumbnail, with the stack trace below. The crash occurs after successfully saving the image itself, which can found in the expected folder.

W/MediaStore(25518): Failed to obtain thumbnail for content://media/external/images/media/622
W/MediaStore(25518): java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
W/MediaStore(25518): 	at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:149)
W/MediaStore(25518): 	at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705)
W/MediaStore(25518): 	at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1687)
W/MediaStore(25518): 	at android.content.ContentResolver.openTypedAssetFile(ContentResolver.java:1592)
W/MediaStore(25518): 	at android.content.ContentResolver.lambda$loadThumbnail$0(ContentResolver.java:3590)
W/MediaStore(25518): 	at android.content.-$$Lambda$ContentResolver$7ILY1SWNxC2xhk-fQUG6tAXW9Ik.call(Unknown Source:10)
W/MediaStore(25518): 	at android.graphics.ImageDecoder$CallableSource.createImageDecoder(ImageDecoder.java:550)
W/MediaStore(25518): 	at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1847)
W/MediaStore(25518): 	at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1840)
W/MediaStore(25518): 	at android.content.ContentResolver.loadThumbnail(ContentResolver.java:3589)
W/MediaStore(25518): 	at android.content.ContentResolver.loadThumbnail(ContentResolver.java:3573)
W/MediaStore(25518): 	at android.provider.MediaStore$InternalThumbnails.getThumbnail(MediaStore.java:1553)
W/MediaStore(25518): 	at android.provider.MediaStore$Images$Thumbnails.getThumbnail(MediaStore.java:1912)
W/MediaStore(25518): 	at a.a.a.a(Unknown Source:178)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
JesseScottcommented, Nov 24, 2019

I am also seeing this… I thought it was only when saving images w/ the Camera in landscape mode at first, but can confirm that this is an Android 10 issue…

0reactions
lecicdjurocommented, Apr 25, 2021

Fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storage updates in Android 11 - Android Developers
Maintain compatibility with Android 10; Migrate data to directories that are visible when using scoped storage; Test scoped storage.
Read more >
What is Scoped Storage in Android?
With Scoped Storage, things are both more restrictive and easier at the same time. A compatible app is given its own folder for...
Read more >
Scoped Storage in Android 10 & Android 11 | by Gaurav Goyal
A controversial storage access change, slated for Android 10, becomes mandatory for Android 11. This blog talks about scoped storage, ...
Read more >
Implementing Scoped Storage in Android 10 - Heartbeat
To give users more control over their files and to limit file clutter, apps that target Android 10 (API level 29) and higher...
Read more >
Scoped Storage in Android 10: Getting Started
In Android 10, Google introduced the concept of scoped storage, which enhances user control and privacy while cutting back the file clutter that ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found