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.

Camera - Android - Not respecting SaveGallery Flag when set to False

See original GitHub issue

Description of the problem: Using Capacitor camera plugin and adding saveToGallery: false, the picture it’s being saved anyway on the galery, only happening on Android. Affected platform

  • [ x ] Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • [ x] macOS
  • linux

Other information: Here’s my function : async takePicture(metadata) { const milliseconds = new Date().getTime(); const timestamp = (milliseconds.toString()).substring(9, 13); const image = await Plugins.Camera.getPhoto({ quality: 70, resultType: CameraResultType.Uri, saveToGallery: false, source: CameraSource.Camera }); }

Capacitor version: 1.1.1 node version: v10.16.0 npm version: 6.9.0 CocoaPods version: 1.7.5

Steps to reproduce:

  1. Take a picture using Android.
  2. Go to pictures gallery the image will be there.

Link to sample project:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
gunshacommented, Oct 7, 2020

Hey guys, i’ve found out about this issue today as one client of my app was complaining of low storage space, which was weird as I was using base64 capture, thought that the temporary images were deleted after capture, but no, and if you don’t use Uri result type you don’t get the full path of the image, so in the meantime i’m just clearing the pictures folder content, hope that this helps someone:

async clearPicturesFolder(){
        if (this.platform.is('android')){
            const picturesFolder = await Filesystem.getUri({directory: FilesystemDirectory.External, path: 'Pictures'});
            Filesystem.readdir({path: picturesFolder.uri}).then( (dir) => {
                dir.files.forEach((file) => {
                    Filesystem.deleteFile({path: picturesFolder.uri + '/' + file });
                });
            });
        }
    }
0reactions
ionitron-bot[bot]commented, Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change app permissions on your Android phone
To change a permission setting, tap it, then choose Allow or Don't allow. For location, camera, and microphone permissions, you may be able...
Read more >
Cordova camera saves to gallery even on false - Stack Overflow
I have verified the same, but it works as expected. I had set saveToGallery flag to true. If I cancel, image is not...
Read more >
Behavior changes: all apps - Android Developers
On Android 12, camera apps that request a specific screen orientation and are not resizable ( resizeableActivity="false" ) automatically enter inset ...
Read more >
photo_manager | Flutter Package - Pub.dev
A Flutter plugin that provides assets abstraction management APIs without UI integration, you can get assets (image/video/audio) on Android, iOS and macOS.
Read more >
Accessing the Camera and Stored Media - CodePath Cliffnotes
In your AndroidManifest.xml, add the following queries block: <manifest ...> <queries> <!-- Camera --> <intent> <action android:name="android.media.action.
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