Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70813

How to save file on new android

$
0
0

Hi all,

I want to save a image locally, maybe in Documents or Gallery. But How can I do that?

Here is my code:

  const canvas = await html2canvas(
    document.querySelector("#beautifulImage") as any
  )

 const res = await Filesystem.writeFile({
    path: `myImage.png`,
    data: canvas.toDataURL(),
    directory: Directory.Documents,
  })

However, it comes error and say: directory is not created!!!

Finally, I found this works: addandroid:requestLegacyExternalStorage="true" in the application tag in the AndroidManifest.xml, however, the document said, it won’t work on android 11 or newer???

How can I do it correctly?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70813

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>