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

199
Vistas
App exits automatically once it saves a .xlsx file into the phone storage

I'm able to save .xlsx file into the phone storage but I've two issues.

  • App exits automatically once it saves a .xlsx file into the phone storage.

  • .xlsx file is saving in 'DCIM' folder, but I need to save in 'Download' folder.

    handleDownload = async () => {
    const data = this.handleDownloadAbleLogs();
    
    if (!data.length)
      return ToastAndroid.showWithGravity(
        "Sorry, no logs available to download.",
        ToastAndroid.LONG,
        ToastAndroid.CENTER
      );
    
    const ws = XLSX.utils.json_to_sheet(data);
    const wb = XLSX.utils.book_new();
    
    XLSX.utils.book_append_sheet(wb, ws, "Logs");
    
    const wbout = XLSX.write(wb, {
      type: "base64",
      bookType: "xlsx",
    });
    const uri = `${FileSystem.cacheDirectory}logs.xlsx`;
    
    try {
      await FileSystem.writeAsStringAsync(uri, wbout, {
        encoding: FileSystem.EncodingType.Base64,
      });
      console.log(uri);
      this.saveXLSXFile(uri);
      alert("Logs file has been saved in DCIM folder, do check there.");
    } catch (e) {
      console.error(e);
    }};
    
    
     saveXLSXFile = async (fileUri) => {
        const { status } = await MediaLibrary.requestPermissionsAsync();
        if (status === "granted") {
          const asset = await MediaLibrary.createAssetAsync(fileUri);
          await MediaLibrary.createAlbumAsync("Download", asset, false);
        } else alert("We need you permission to download this file.");   
    };
    
about 4 years ago · Juan Pablo Isaza
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