Ionic3 camera getPicture saves photo twice


#1

I am creating a project where I take pictures and store them on device (internal/external memory) + show them in lists. i have some issues because the photos taken are automatically saved also in DCIM/Camera folder (internal memory or memory card) even though i don’t do that.
This is the camera config:
this.cameraOptions = {
quality: 75,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
sourceType: this.camera.PictureSourceType.CAMERA,
mediaType: this.camera.MediaType.PICTURE,
saveToPhotoAlbum: false
}

public takePicture(){
return new Promise((resolve, reject) => {
let file_name=‘IMG_’+(Math.floor(Date.now() / 1000))+’.jpg’;
let file_location=this.platform.is(‘android’) ? (this.helper.general_settings[‘store_external’] && this.helper.general_settings[‘externalDirectory’] ? this.helper.general_settings[‘externalDirectory’] : this.file.dataDirectory) : this.file.dataDirectory;
this.helper.showLoading();
this.camera.getPicture(this.cameraOptions).then((imageData) => {
let sourceDir=imageData.substring(0,imageData.lastIndexOf(’/’) +1);
let sourceFileName=imageData.substring(imageData.lastIndexOf(’/’) +1,imageData.length);
this.file.moveFile(sourceDir,sourceFileName,file_location,file_name)
.then((fileDone:any) => {
resolve({‘file_name’:file_name, ‘file_location’:file_location });
}).catch(error => {
reject(error);
//console.log(error);
});
}, (err) => {
reject(err);
console.log(err);
});
});
}

The idea is that the same photo is saved automatically also in DCIM/Camera (outside the application on the system the base location for saving pictures is on the memory card) - I know that the function getPicture saves the photo to the temporary folder and from there I move it to where I need to be (this happens when I accept the photo after I see the snapshot and I am redirected back to my application, so the accept feature triggers it to be saved in 2 places).

I don’t see in the gallery the photo which is saved to DCIM/Camera , but I see it when i navigate the card folders through file manager, so saveToPhotoAlbum does not help here. has someone encountered this - if yes how solved?

System: Motorola x play, android 7.1.1, cordova-plugin-camera 4.0.3