Sahil
Sahil

Reputation: 553

ionic app not allowed to access photo data

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

Answers (1)

D.ray83
D.ray83

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

Related Questions