Ad

Ionic 4: How To Save Images On Device For Offline Mode That Comes From Firebase Storage

I use SQLite native plugin for storing the text content but I need to do that with images too! ( For OFFLINE mode )

Converting the images to base64 string didn't work out with angular/ionic 4 so my question is:

How to download the images with Native file transfer plugin provided by ionic/Cordova from images urls that comes from Firebase

I have read the docs but it is to basic and don't give much!

the code the DOCS provide: ( I don't understand file.pdf on download method! the images can come with any extension like jpg/png ..etc )

download() {
  const url = 'http://www.example.com/file.pdf';
  fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => {
    console.log('download complete: ' + entry.toURL());
  }, (error) => {
    // handle error
  });
}

Ad

Answer

Thanks for responding but I have figured out!

I have stored my Images on the phone then converted into a base64 image by using Cordova plugin for that which you can find here then I added the base64 image to my storage with the text content.

Ad
source: stackoverflow.com
Ad