Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alanflickgames opened this issue Oct 18, 2024 · 2 comments
Open

Comments

@alanflickgames
Copy link

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
Copy link
Author

@scottrules44 Am I correct that the fix in #737 will fix for this issue too? Presumably media.save uses the same java function for saving to the library as display.capture/save?

@alanflickgames
Copy link
Author

I've tested both display.capture( img, { saveToPhotoLibrary=true, captureOffscreenArea=true } ) and media.save( fileName, fileDirectory ).

display.capture now works as expected, but media.save does not. I had assumed they both used the same saveToLibrary function behind the scenes, but presumably they don't. I can just use display.capture for now so it's not a problem, but for others that might not be suitable.

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

No branches or pull requests

2 participants
@alanflickgames and others