mit-cml / appinventor-sources

MIT App Inventor Public Open Source
http://appinventor.mit.edu/appinventor-sources/
Apache License 2.0
1.48k stars 2.07k forks source link

SoundRecorder doesn't ask for external write permission #2008

Closed ewpatton closed 4 years ago

ewpatton commented 4 years ago

Describe the bug

SoundRecorder stores recordings to the external storage by default (or if the user gives it an external path). Further, it asserts this in @UsesPermissions. However, when we start recording we only ever ask for RECORD_AUDIO and not WRITE_EXTERNAL_STORAGE. We likely missed this in testing the SDK 26 update by only testing it in the companion (which does request write access up front) and not in a compiled app.

Affects

Expected behavior

In a compiled app, SoundRecorder should request write permission in addition to audio recording.

Steps to reproduce

  1. Create an app with a Button and a SoundRecorder.
  2. Have the button trigger start recording.
  3. Compile the app and test on a device running Android 6.0 Marshmallow or higher. You will get a permission denied error when attempting to start the recording.
singhalsara8 commented 4 years ago

@ewpatton I would like to work on this issue.

ewpatton commented 4 years ago

@singhalsara8 Sure. Take a look at the TakePicture method of Camera to see an example of how you can request multiple permissions. You'll want to adapt the code in SounderRecorder's Start method to be similar.