corona icon indicating copy to clipboard operation
corona copied to clipboard

Android: media.save() function fails to save to photo library

Open alanflickgames opened this issue 4 months ago • 0 comments

Describe the bug The media.save function may need to be updated for Android, as it doesn't save anything at all. No error messages or any other feedback are generated to indicate why, but nothing happens.
display.capture( displayObject, { saveToPhotoLibrary=true, captureOffscreenArea=true } ) behaves the same way.

To Reproduce Steps to reproduce the behavior:

  1. Call media.save("inputImageFilename.jpg", system.DocumentsDirectory)
  2. Observe that file is not saved, and no errors are generated

Target platform and where build was made:

  • Device: Pixel 7a
  • OS: Android 14 and Android 13

Additional context Appears to be Android specific, as both methods work fine on iOS (as long as the permission strings are set in the plist).

Google made some changes to External Storage permissions a couple of years ago, this issue could be related. The answer marked as correct here might be how it now needs to work as it has different behaviours depending on Build.VERSION.SDK_INT: https://stackoverflow.com/questions/71729415/saving-an-image-and-displaying-it-in-gallery

alanflickgames avatar Oct 18 '24 16:10 alanflickgames