apache / cordova-plugin-media

Apache Cordova Media Plugin
https://cordova.apache.org/
Apache License 2.0
388 stars 767 forks source link

(android) Simple fix to handle new write permissions schemas on Android 13 (TIRAMISU) #380

Closed rodolfocondemx closed 1 year ago

rodolfocondemx commented 1 year ago

This PR is intended to fix an issue with recording audio in Android 13 onwards

Platforms affected

Android

Motivation and Context

Audio cannot be recorded using the method promptForRecord of the plugin, because of the changes made in Android 13 for the WRITE_EXTERNAL_STORAGE permissions, which always is denied in Android 13

Description

This PR contributes a simple edit to the method promptForRecord of the AudioHandler class, which makes it always evaluate to true when the plugin checks if the app has the permission WRITE_EXTERNAL_STORAGE in Android 13. Previous Android versions should behave just like before.

Testing

I tested the change using the plugin in a android app project, where we use the plugin to record audio in various places, with my Android 13 enabled tablet and previous behaviour was tested with my Android 12 phone.

Checklist