jordanorc commented on issue #271:
URL: 
https://github.com/apache/cordova-plugin-media/issues/271#issuecomment-728310108


   A minimal reproduction app can be found here: 
https://github.com/jordanorc/reproduction-sample-issue-271
   
   Some details about the problem:
   
   The problem seems to be related to Android 10. Apps targeting Android 10 
(API level 29) and higher are given scoped access into an external storage 
device, or scoped storage, by default. Such apps can see only their 
app-specific directory.
   
   As pointed by @brunocbatista, adding `<application 
android:requestLegacyExternalStorage="true" />`to `<edit-config>` in the 
`config.xml` file seems to solve the problem.
   
   Looking the code, the problem is in 
[AudioPlayer.java](https://github.com/apache/cordova-plugin-media/blob/master/src/android/AudioPlayer.java#L111),
 in `generateTempFile()` function.
   
   Keeping the temp file in app directory instead of external storage seems to 
solve the problem.
   
   ```java
   private String generateTempFile() {
       String tempFileName = "/data/data/" + 
handler.cordova.getActivity().getPackageName() + "/cache/tmprecording-" + 
System.currentTimeMillis() + ".3gp";
       return tempFileName;
   }
   ```
   
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to