Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
Ionic 5 Native File plugin not writing files to dataDirectory

I'm trying to read and write files on the user's device. I'm using the Ionic File plugin, but whenever I try to create or write files, it gives no error, but does not create them.

The code that writes the files is a simple function only executing one line:

file.writeFile(file.dataDirectory + folderName, fileName, data, { replace: true });

Again, this code gives no errors, But when I navigate over to the folder on my phone Android/my.app.id/files/, the folder is empty.

I've tried changing my config.xml file as suggested by other forum posts by adding:

<allow-navigation href="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="file://*/*" />
<allow-intent href="*" />

I've also tried using the other directory options in the plugin, but am met with ENCODING_ERR.

How do I fix this?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

So I've found the solution. I just set the directory to externalDataDirectory instead of dataDirectory.

about 4 years ago · Juan Pablo Isaza Report

0

for android 10 add set this flag requestLegacyExternalStorage to true for android 11 you need The new MANAGE_EXTERNAL_STORAGE

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!