Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11396

Audio Media Capture Crashes if app stores file on external storage

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Android

      Description

      I’ll go over the issue that we were seeing and that we want to address with this fix:

      • The app crashes when returning from the recorder application (RecForge) when it tries to get the recorded audio – in onAudioActivityResult.
      • This only happens if the app doesn’t already have the READ_EXTERNAL_STORAGE permission already allowed. If the permissions for image get accepted this issue will not reproduce anymore.
      • The READ_EXTERNAL_STORAGE is part of the manifest but is not requesting permissions from anywhere else except this plugin.

      Stack trace:

      java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/audio/media/8706 from pid=12598, uid=10333 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
      at android.os.Parcel.readException(Parcel.java:1599)
      at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
      at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
      at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
      at android.content.ContentResolver.query(ContentResolver.java:491)
      at android.content.ContentResolver.query(ContentResolver.java:434)
      at org.apache.cordova.CordovaResourceApi.mapUriToFile(CordovaResourceApi.java:154)
      at org.apache.cordova.mediacapture.Capture.createMediaFile(Capture.java:465)
      at org.apache.cordova.mediacapture.Capture.onAudioActivityResult(Capture.java:364)
      at org.apache.cordova.mediacapture.Capture$1.run(Capture.java:321)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
      at java.lang.Thread.run(Thread.java:818)

        Attachments

          Activity

            People

            • Assignee:
              macdonst Simon MacDonald
              Reporter:
              macdonst Simon MacDonald
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: