Remove photo gallery images


#1

I developed an android app, with camera plugin. I save photo in the photo gallery.
I set saveToPhotoAlbum: true in the camera options parameter.

Then i want to remove the photo. I used:

 window.resolveLocalFileSystemURL(path, function (result) {
          result.remove(function(){
              console.log("ok"):
          });
        }, function(error){
            console.log("nok"):
        }
      );

The path of the photo is something similar to this: file:///storage/emulated/0/Pictures/myphoto.jpg.

The method seems to work, but if I open the photo gallery, the photo is already present. It has a strange behaviour. Sometimes the small preview is valid, but if I open the photo it shows me an invalid image, with an invalid message and darkgray background. Other times I continue to get the photo.

How I can remove photo from gallery in the android device correctly, with ionic 2 and cordova?