Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

229
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda