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

198
Views
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
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!