Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda