cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject cordova-plugin-media-capture git commit: CB-11396 - Audio Media Capture Crashes if app stores file on external storage
Date Wed, 08 Jun 2016 22:50:03 GMT
Repository: cordova-plugin-media-capture
Updated Branches:
  refs/heads/master bae9cdbab -> 2d74abe4a


CB-11396 - Audio Media Capture Crashes if app stores file on external storage


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/commit/2d74abe4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/tree/2d74abe4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/diff/2d74abe4

Branch: refs/heads/master
Commit: 2d74abe4af8fe5be92cfab07187e5f3701070e13
Parents: bae9cdb
Author: Simon MacDonald <simon.macdonald@gmail.com>
Authored: Wed Jun 8 18:49:55 2016 -0400
Committer: Simon MacDonald <simon.macdonald@gmail.com>
Committed: Wed Jun 8 18:49:55 2016 -0400

----------------------------------------------------------------------
 plugin.xml               | 1 +
 src/android/Capture.java | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/2d74abe4/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index d4082aa..9342b4d 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -77,6 +77,7 @@ xmlns:rim="http://www.blackberry.com/ns/widgets"
         <config-file target="AndroidManifest.xml" parent="/*">
             <uses-permission android:name="android.permission.RECORD_AUDIO" />
             <uses-permission android:name="android.permission.RECORD_VIDEO"/>
+            <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
             <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
/>
         </config-file>
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/2d74abe4/src/android/Capture.java
----------------------------------------------------------------------
diff --git a/src/android/Capture.java b/src/android/Capture.java
index befca96..3ba5132 100644
--- a/src/android/Capture.java
+++ b/src/android/Capture.java
@@ -223,9 +223,13 @@ public class Capture extends CordovaPlugin {
      * Sets up an intent to capture audio.  Result handled by onActivityResult()
      */
     private void captureAudio(Request req) {
-        Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
+      if (!PermissionHelper.hasPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE))
{
+          PermissionHelper.requestPermission(this, req.requestCode, Manifest.permission.READ_EXTERNAL_STORAGE);
+      } else {
+          Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
-        this.cordova.startActivityForResult((CordovaPlugin) this, intent, req.requestCode);
+          this.cordova.startActivityForResult((CordovaPlugin) this, intent, req.requestCode);
+      }
     }
 
     private String getTempDirectoryPath() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message