Reputation: 553
i am using this code to save image from dataUrl, it is giving error permission denied. How to save image with this dataUrl in app folder?
this.PhotoLibrary.requestAuthorization().then(() => {
this.PhotoLibrary.saveImage(dataUrl,'MyHomeLibrary',options).then((data) => {
console.log('data',data);
})
.catch(err => console.log(err));
// Do stuff after you have permission!
})
Upvotes: 3
Views: 1886
Reputation: 46
I had the same problem and was able to fix it by doing this
this.photoLibrary.requestAuthorization({read:true,write:true})
Found the answer here - Android oreo : Permission Denial: This application is not allowed to access Photo data.
UPDATE:
From Android O we have to call request Authorization method like below
this.photoLibrary.requestAuthorization()
The Above method need to replace with
this.photoLibrary.requestAuthorization({read:true,write:true})
Upvotes: 3