Camera plugin not saving to Gallery


#1

I have this code:-

var camera = require("nativescript-camera");

exports.onTakePicTap = function(){
var milliseconds = (new Date).getTime();
var options = { width: 480, height: 480, keepAspectRatio: true, saveToGallery: true };
camera.takePicture(options).then(function(picture) {
        appSettings.setBoolean("vehiclephoto", true);
        myImage.src = picture;
        //appSettings.setString("mypic",picture);
        console.log("Picture = "+picture);
        picture.saveToGallery = true;
        }).catch(function (err) {
        console.log("Error -> " + err.message);
});
}

I cannot get the image to save to the Gallery no matter what I try.


#2

Refer plugins docs carefully, saveToGallery is a property of options object.


#3

I have set var options saveToGallery: true as per my code.

The issue was I had not requested permissions to use the photos.

camera.requestPermissions();