Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-14149

Android usage of cordova.file.dataDirectory does not let save the audio

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.0.1
    • Fix Version/s: None
    • Component/s: cordova-plugin-media
    • Labels:
      None

      Description

      Hello, due to a difference between mount points I think, the call to

      public void moveFile(String file) {

      after recording fails due to the impossibility of moving data from the tmp save to the final destination, as

      f.renameTo fails

      I replaced the f.renameTo with other code

       

      try {
       File f = new File(this.tempFile);
       File fileOut = new File(file);
       fileOut.createNewFile();
       Reader in = new FileReader(f);
       Writer out = new FileWriter(fileOut);
       IOUtils.copy(in,out);
       in.close();
       out.close();
       f.delete();
      } catch (IOException e) {
       e.printStackTrace();
      }
      //if (!f.renameTo()) LOG.e(LOG_TAG, "FAILED " + logMsg);

      It seems to work properly, and is more generic, even if I had to add IOUtils ad dependency to use it (it can be even without, but there's more code).

      If you prefer, I can join and patch the code with this, just to contribute.

      Hope it helps

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              massimiliano@perantoni.net Massimiliano Perantoni
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified