You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "suzukieng (via GitHub)" <gi...@apache.org> on 2023/06/06 08:37:52 UTC
[GitHub] [cordova-plugin-media] suzukieng opened a new issue, #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
suzukieng opened a new issue, #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373
# Bug Report
## Problem
### What is expected to happen?
Recording audio should work on Android 13.
### What does actually happen?
Recording audio fails, because the permission request for `WRITE_EXTERNAL_STORAGE` always fails on Android 13.
The check is always for both `RECORD_AUDIO` and `WRITE_EXTERNAL_STORAGE`.
## Information
The app does not request legacy external storage.
I've seen #268 but from my understanding that change only removes the permission from the manifest, but it still tries to acquire it a runtime?
### Command or Code
`media.startRecord()`
### Environment, Platform, Device
Android 13 running on Samsung Galaxy S20
### Version information
cordova-media-plugin 6.1
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] mirko77 commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "mirko77 (via GitHub)" <gi...@apache.org>.
mirko77 commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1590957134
I have seen the other commit by [adrianhardy](https://github.com/adrianhardy), I am not sure it works on old devices targeting a lower API though
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] mirko77 commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "mirko77 (via GitHub)" <gi...@apache.org>.
mirko77 commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1589696998
That was removed a while ago https://github.com/apache/cordova-plugin-media/commit/e8ca2244d04b5f9463b9c01ba1a47bce3eace0bb
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] suzukieng commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "suzukieng (via GitHub)" <gi...@apache.org>.
suzukieng commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1591147912
@mirko77 No, I haven't tested it, but judging from your code it will work. That's exactly how I locally patched it at first. We decided to write a separate plugin in our app to handle audio recording. We have a custom native app where we embed Cordova as a "library", so this was easy for us to do.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] mirko77 commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "mirko77 (via GitHub)" <gi...@apache.org>.
mirko77 commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1591113288
@suzukieng have you tried my fork?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] suzukieng commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "suzukieng (via GitHub)" <gi...@apache.org>.
suzukieng commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1589801281
> `WRITE_EXTERNAL_STORAGE` was removed a while ago [e8ca224](https://github.com/apache/cordova-plugin-media/commit/e8ca2244d04b5f9463b9c01ba1a47bce3eace0bb)
In the manifest, yes. But it’s still requested at run-time:
https://github.com/apache/cordova-plugin-media/blob/a8bbc02a06cbf01328738ee3e76cac7e32efa042/src/android/AudioHandler.java#L571
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] mirko77 commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "mirko77 (via GitHub)" <gi...@apache.org>.
mirko77 commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1590950239
I tried and it works, at least on Android 13 and 11 with API 33. I do not have any Android 12 devices.
`READ_MEDIA_AUDIO` is not needed.
@suzukieng you can try this fork https://github.com/epicollect5/cordova-plugin-media
@breautek I added a pull request
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] adrianhardy commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "adrianhardy (via GitHub)" <gi...@apache.org>.
adrianhardy commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1595723809
Forgive my ignorance, but when looking at your suggested fix:
```
String READ_IMAGES_PERMISSION =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ?
Manifest.permission.READ_MEDIA_IMAGES : Manifest.permission.READ_EXTERNAL_STORAGE;
```
Is that providing support for building using older "compileSDK"? Or is that a requirement to support multiple android versions at runtime?
Again, apologies if that's a silly question - I don't know a lot about Java, Android SDK, etc.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] suzukieng commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "suzukieng (via GitHub)" <gi...@apache.org>.
suzukieng commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1596600315
Hi @adrianhardy. It's just basically saying "if you're running on Android 13, request READ_MEDIA_IMAGES permission, otherwise request READ_EXTERNAL_STORAGE permission". So this makes an app targeting Android 13 comply with platform requirements, while falling back to legacy behavior on older Android versions (which have no READ_MEDIA_IMAGES permission). The ternary expression might make it a big hard to read.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] mirko77 commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "mirko77 (via GitHub)" <gi...@apache.org>.
mirko77 commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1589845910
Good point. That might explain why we cannot get it to work on Android 13 when targeting API 33, as that permission `WRITE_EXTERNAL_STORAGE ` will always be denied.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] suzukieng commented on issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "suzukieng (via GitHub)" <gi...@apache.org>.
suzukieng commented on issue #373:
URL: https://github.com/apache/cordova-plugin-media/issues/373#issuecomment-1591080335
@mirko77 correct, `READ_MEDIA_AUDIO` was introduced in API level 33+. An app that previously used `READ_EXTERNAL_STORAGE` should now request `READ_MEDIA_*`.
So something like this is needed:
```
String READ_IMAGES_PERMISSION =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ?
Manifest.permission.READ_MEDIA_IMAGES : Manifest.permission.READ_EXTERNAL_STORAGE;
```
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-plugin-media] erisu closed issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
Posted by "erisu (via GitHub)" <gi...@apache.org>.
erisu closed issue #373: Can't record audio on app targeting Android 13 due to plugin requesting WRITE_EXTERNAL_STORAGE permission (which always fails)
URL: https://github.com/apache/cordova-plugin-media/issues/373
--
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.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org