chriskhongqarma opened a new pull request #215: URL: https://github.com/apache/cordova-plugin-media-capture/pull/215
### Android ### Motivation and Context Since the [Storage updates](https://developer.android.com/about/versions/11/privacy/storage) in Android 11, it would be impossible for app to get access to files (image, audio, video) saved into MediaStore external storage, as how it is implemented now. Starting from 2021 August, Android apps are required to target Android API level 30 (Android 11), which means it is critical that we need a new way to store files for media-capture plugin. More details are included in the issue #210. Here is a suggested implementation for the above issue. ### Description The idea is to use a ContentProvider (a [FileProvider](https://developer.android.com/reference/androidx/core/content/FileProvider), in this case) as a common database to store files, so that both our app and other apps can get access to. An empty file (audio, image, video) with unique file name (which is generated using current timestamp) and corresponding file format will be created before capturing. Unique file name prevents the file from being duplicated. We use FileProvider to create a Uri for the file, and send it through capturing intents as [`EXTRA_OUTPUT`](https://developer.android.com/reference/android/provider/MediaStore#EXTRA_OUTPUT), so that the created file will be saved with the above Uri. Meanwhile, we store the file absolute path as a global variable, so that it can be used when the intent returns results. As the file is saved into FileProvider, the app will get access and have control over the created file. ### Testing captureAudio, captureImage, captureVideo features are tested over various Android devices (from Android 7 to Android 11 are covered) using [browserstack](https://www.browserstack.com/) app live. The app then has full access over the generated media file (move, delete, transcode, etc). ### Checklist - [x] I've run the tests to see all new and existing tests pass - [x] I added automated test coverage as appropriate for this change - [x] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`) - [x] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) - [x] I've updated the documentation if necessary -- 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]
