You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/04/13 10:52:58 UTC

[GitHub] [cordova-plugin-media-capture] chriskhongqarma opened a new pull request #215: [Android] Save image/audio/video to FileProvider instead of MediaStore external…

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:
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-capture] breautek commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
breautek commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-819501527


   Cordova-android AndroidX reference: https://github.com/apache/cordova-android/pull/1052


-- 
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:
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-capture] chriskhongqarma commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r614025121



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       Would it be merged if the travis automated tests fail? AFAIK in August it is required for Android app to target Android 11, and by then this plugin will not function properly.




-- 
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:
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-capture] breautek commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
breautek commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745032528



##########
File path: src/android/Capture.java
##########
@@ -301,6 +328,16 @@ private void captureVideo(Request req) {
             PermissionHelper.requestPermission(this, req.requestCode, Manifest.permission.CAMERA);
         } else {
             Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
+            String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+            String fileName = "VID_" + timeStamp + ".avi";

Review comment:
       Is it save to assume file extension to begin with? I imagine this could differ depending on the underlying camera app.




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744040968



##########
File path: src/android/Capture.java
##########
@@ -399,32 +432,18 @@ public void onImageActivityResult(Request req) {
     }
 
     public void onVideoActivityResult(Request req, Intent intent) {
-        Uri data = null;
-
-        if (intent != null){
-            // Get the uri of the video clip
-            data = intent.getData();
-        }
-
-        if( data == null){
-            File movie = new File(getTempDirectoryPath(), "Capture.avi");
-            data = Uri.fromFile(movie);
-        }
-
-        // create a file object from the uri
-        if(data == null) {
+        if(this.videoAbsolutePath != null) {
+            req.results.put(createMediaFileWithAbsolutePath(this.videoAbsolutePath));
+        } else {
             pendingRequests.resolveWithFailure(req, createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null"));
         }
-        else {
-            req.results.put(createMediaFile(data));
 
-            if (req.results.length() >= req.limit) {
-                // Send Uri back to JavaScript for viewing video
-                pendingRequests.resolveWithSuccess(req);
-            } else {
-                // still need to capture more video clips
-                captureVideo(req);
-            }
+        if (req.results.length() >= req.limit) {
+            // Send Uri back to JavaScript for viewing video
+            pendingRequests.resolveWithSuccess(req);
+        } else {
+            // still need to capture more videos
+            captureVideo(req);
         }
     }
 

Review comment:
       and other unused elements now like `queryImgDB`, `checkForDuplicateImage`, `whichContentStore`, `numPics` that should be removed too




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744040674



##########
File path: src/android/Capture.java
##########
@@ -488,6 +507,62 @@ private JSONObject createMediaFile(Uri data) {
         return obj;
     }
 
+    /**
+     * Creates a JSONObject that represents a File from the Uri
+     *
+     * @param path the absolute path saved in FileProvider of the audio/image/video
+     * @return a JSONObject that represents a File
+     * @throws IOException
+     */
+    private JSONObject createMediaFileWithAbsolutePath(String path) {
+        File fp = new File(path);
+        JSONObject obj = new JSONObject();
+
+        Class webViewClass = webView.getClass();
+        PluginManager pm = null;
+        try {
+            Method gpm = webViewClass.getMethod("getPluginManager");
+            pm = (PluginManager) gpm.invoke(webView);
+        } catch (NoSuchMethodException e) {
+        } catch (IllegalAccessException e) {
+        } catch (InvocationTargetException e) {
+        }
+        if (pm == null) {
+            try {
+                Field pmf = webViewClass.getField("pluginManager");
+                pm = (PluginManager)pmf.get(webView);
+            } catch (NoSuchFieldException e) {
+            } catch (IllegalAccessException e) {
+            }
+        }
+        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
+        LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath());
+
+        try {
+            // File properties
+            obj.put("name", fp.getName());
+            obj.put("fullPath", Uri.fromFile(fp));
+            if (url != null) {
+                obj.put("localURL", url.toString());
+            }
+            // Because of an issue with MimeTypeMap.getMimeTypeFromExtension() all .3gpp files
+            // are reported as video/3gpp. I'm doing this hacky check of the URI to see if it
+            // is stored in the audio or video content store.
+            if (fp.getAbsoluteFile().toString().endsWith(".3gp") || fp.getAbsoluteFile().toString().endsWith(".3gpp")) {
+                obj.put("type", VIDEO_3GPP);

Review comment:
       why just this line? was previously
   ```
                   if (data.toString().contains("/audio/")) {
                       obj.put("type", AUDIO_3GPP);
                   } else {
                       obj.put("type", VIDEO_3GPP);
                   }
   ```




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745033882



##########
File path: src/android/Capture.java
##########
@@ -399,32 +432,18 @@ public void onImageActivityResult(Request req) {
     }
 
     public void onVideoActivityResult(Request req, Intent intent) {
-        Uri data = null;
-
-        if (intent != null){
-            // Get the uri of the video clip
-            data = intent.getData();
-        }
-
-        if( data == null){
-            File movie = new File(getTempDirectoryPath(), "Capture.avi");
-            data = Uri.fromFile(movie);
-        }
-
-        // create a file object from the uri
-        if(data == null) {
+        if(this.videoAbsolutePath != null) {

Review comment:
       I suggest to remove the check on `videoAbsolutePath != null` ; no such check for audio or image, and the absolutePath is always defined when this method is called




-- 
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-capture] chriskhongqarma commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-823184181


   @andreycruz16 I can see that the recorded video is still saved in external storage. Could you make sure that you pulled the code from this PR? It should save the video into a FileProvider, and the video uri should look like this. `file:///data/user/0/{applicationID}/cache/VID_20210420130001621.avi`


-- 
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:
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-capture] andreycruz16 commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
andreycruz16 commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-823067999


   Does this fix this issue?
   I cant play the recorded video on WebView.
   
   Cordova: 8.1.2
   Cordova-Android: 9.0.0
   cordova-plugin-media-capture: 1.4.3
   
   ![image](https://user-images.githubusercontent.com/11815512/115359650-7827da00-a1f1-11eb-86c7-2727f21e6b30.png)
   


-- 
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:
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-capture] PabbleDabble commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
PabbleDabble commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r677408919



##########
File path: src/android/Capture.java
##########
@@ -399,32 +432,18 @@ public void onImageActivityResult(Request req) {
     }
 
     public void onVideoActivityResult(Request req, Intent intent) {
-        Uri data = null;
-
-        if (intent != null){
-            // Get the uri of the video clip
-            data = intent.getData();
-        }
-
-        if( data == null){
-            File movie = new File(getTempDirectoryPath(), "Capture.avi");
-            data = Uri.fromFile(movie);
-        }
-
-        // create a file object from the uri
-        if(data == null) {
+        if(this.videoAbsolutePath != null) {
+            req.results.put(createMediaFileWithAbsolutePath(this.videoAbsolutePath));
+        } else {
             pendingRequests.resolveWithFailure(req, createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null"));
         }
-        else {
-            req.results.put(createMediaFile(data));
 
-            if (req.results.length() >= req.limit) {
-                // Send Uri back to JavaScript for viewing video
-                pendingRequests.resolveWithSuccess(req);
-            } else {
-                // still need to capture more video clips
-                captureVideo(req);
-            }
+        if (req.results.length() >= req.limit) {
+            // Send Uri back to JavaScript for viewing video
+            pendingRequests.resolveWithSuccess(req);
+        } else {
+            // still need to capture more videos
+            captureVideo(req);
         }
     }
 

Review comment:
       Should `createMediaFile(Uri data)` be removed?  It doesn't appear to be used / replaced with `createMediaFileWithAbsolutePath(String path)`




-- 
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-capture] chriskhongqarma commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-827026885


   As I explained in this PR,
   `Since the Storage updates 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.`. I suggested a solution with this PR and have been waiting for it to be merged. You can pull the code from this PR and try to see if it works. The file recorded should be saved into a path like this:
   `file:///data/user/0/{applicationID}/cache/VID_20210420130001621.avi`


-- 
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:
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-capture] mirko77 commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
mirko77 commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-826984377


   @andreycruz16 , @chriskhongqarma On android 11, Lineage OS 18.1, the video gets saved at path:
   
   `fullPath: "file:///data/user/0/{applicationID}/cache/Capture.avi"`
   
   but I cannot find any file there (using a root explorer), therefore I am getting error 1 (not found) when trying to play it or copy it.
   
   Works fine in older Android versions
   
   Any suggestions?
   
   


-- 
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:
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744046586



##########
File path: src/android/Capture.java
##########
@@ -234,6 +246,17 @@ private void captureAudio(Request req) {
           try {
               Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
+              String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+              String fileName = "AUDIO_" + timeStamp + ".wav";
+              File audio = new File(getTempDirectoryPath(), fileName);

Review comment:
       (for all 3 capture types)
   
   I would drop the use of `getTempDirectoryPath` to not write in app temp dir, because this path is cleaned up by the system while such captured audio/image/video should be available afterward in the device media dirs (correct [Environment.DIRECTORY_..](https://developer.android.com/reference/android/os/Environment#DIRECTORY_PICTURES)) as a common practice.
   
   See the *Taking photos* doc : https://developer.android.com/training/camera/photobasics#TaskPath, really similar to what you have done
   - can there be 3 isolated methods like the suggested `createImageFile()`? and not inlined like here
   - use `File.createTempFile`
   - with specific values and correct Environment.DIRECTORY_.. for each of our 3 types
   - and possibly more `<external-files-path` entries inside _mediacapture_provider_paths.xml_ to match that




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745012698



##########
File path: src/android/Capture.java
##########
@@ -234,6 +246,17 @@ private void captureAudio(Request req) {
           try {
               Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
+              String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+              String fileName = "AUDIO_" + timeStamp + ".wav";
+              File audio = new File(getTempDirectoryPath(), fileName);

Review comment:
       The Android training link I shared gives example of using `getExternalFilesDir` (with corresponding _paths.xml_) but this writes to the app private dirs and thus requires to "Add the photo to a gallery" to be similar to the auto-indexing of previous Android and iOS mediacapture code!
   > Note: If you saved your photo to the directory provided by getExternalFilesDir(), the media scanner cannot access the files because they are private to your app.
   
   Do you agree? Or to which dirs will we agree to write _by default_ here?
   
   Any way to capture and write all 3 types to **public** dirs?




-- 
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-capture] chriskhongqarma commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r615631249



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       I think using the old Android library would be a good enough solution for now, we can have another PR to update it to AndroidX when cordova-android 10 is released.




-- 
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:
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-capture] chriskhongqarma commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613999562



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       Agreed.




-- 
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:
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-capture] erisu commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
erisu commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r614023246



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       I am OK with it staying in for the passing of the tests but this PR wont be merged in until then.

##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       I am OK with it staying in for the passing of the tests but this PR wont be merged in until then and might be sitting for a couple of months.




-- 
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:
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745026545



##########
File path: src/android/Capture.java
##########
@@ -488,6 +507,62 @@ private JSONObject createMediaFile(Uri data) {
         return obj;
     }
 
+    /**
+     * Creates a JSONObject that represents a File from the Uri
+     *
+     * @param path the absolute path saved in FileProvider of the audio/image/video
+     * @return a JSONObject that represents a File
+     * @throws IOException
+     */
+    private JSONObject createMediaFileWithAbsolutePath(String path) {
+        File fp = new File(path);
+        JSONObject obj = new JSONObject();
+
+        Class webViewClass = webView.getClass();
+        PluginManager pm = null;
+        try {
+            Method gpm = webViewClass.getMethod("getPluginManager");
+            pm = (PluginManager) gpm.invoke(webView);
+        } catch (NoSuchMethodException e) {
+        } catch (IllegalAccessException e) {
+        } catch (InvocationTargetException e) {
+        }
+        if (pm == null) {
+            try {
+                Field pmf = webViewClass.getField("pluginManager");
+                pm = (PluginManager)pmf.get(webView);
+            } catch (NoSuchFieldException e) {
+            } catch (IllegalAccessException e) {
+            }
+        }
+        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
+        LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath());
+
+        try {
+            // File properties
+            obj.put("name", fp.getName());
+            obj.put("fullPath", Uri.fromFile(fp));
+            if (url != null) {
+                obj.put("localURL", url.toString());
+            }
+            // Because of an issue with MimeTypeMap.getMimeTypeFromExtension() all .3gpp files
+            // are reported as video/3gpp. I'm doing this hacky check of the URI to see if it
+            // is stored in the audio or video content store.
+            if (fp.getAbsoluteFile().toString().endsWith(".3gp") || fp.getAbsoluteFile().toString().endsWith(".3gpp")) {
+                obj.put("type", VIDEO_3GPP);

Review comment:
       the target file is always defined now with file extension/type? (video always as avi/mp4, and audio as wav) so this block about .3gpp files may be removed?
   and only rely on the default `obj.put("type", FileHelper.getMimeType(Uri.fromFile(fp), cordova));` ?




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745015596



##########
File path: src/android/xml/mediacapture_provider_paths.xml
##########
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>

Review comment:
       cordova plugins usually store _res_ files into `src/android/res`: so use `src/android/res/xml/mediacapture_provider_paths.xml` instead of `src/android/xml/mediacapture_provider_paths.xml`




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745031099



##########
File path: src/android/Capture.java
##########
@@ -301,6 +328,16 @@ private void captureVideo(Request req) {
             PermissionHelper.requestPermission(this, req.requestCode, Manifest.permission.CAMERA);
         } else {
             Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
+            String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+            String fileName = "VID_" + timeStamp + ".avi";

Review comment:
       I suggest `".mp4"` instead of `".avi"` as it the file extension I get for video capture with previous code without these FileProvider changes




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745128738



##########
File path: src/android/Capture.java
##########
@@ -301,6 +328,16 @@ private void captureVideo(Request req) {
             PermissionHelper.requestPermission(this, req.requestCode, Manifest.permission.CAMERA);
         } else {
             Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
+            String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+            String fileName = "VID_" + timeStamp + ".avi";

Review comment:
       @breautek I think you're right :/
   
   "but" one more link in Android training docs should be interesting to follow : https://developer.android.com/guide/topics/media/camera.html#saving-media
   for its `getOutputMediaFile()`, with output switch for MEDIA_TYPE_IMAGE or MEDIA_TYPE_VIDEO = "IMG_x.jpg" // "VID_x.mp4"
   
   a similar output extension of `.mp4` can be found in CameraX training too




-- 
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-capture] breautek commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
breautek commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613683579



##########
File path: src/android/Capture.java
##########
@@ -59,7 +59,7 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.net.Uri;
 import android.os.Environment;
 import android.provider.MediaStore;
-import androidx.core.content.FileProvider;

Review comment:
       Hmm, what kind of trouble?
   
   Unfortunately I don't think requiring users to install `cordova-plugin-androidx-adapter` because of an Apache maintained plugin is acceptable, even though they will very likely require it for other third-party plugins.
   
   I can do my best to assist, but I only have beginner to moderate knowledge of Android native development. You can also try reaching out to our [Slack Community](http://slack.cordova.io/) and our [Dev Mailing List](https://cordova.apache.org/contact/) for assistance.
   
   Note that the Dev Mailing list is for discussions about developing Apache maintained cordova packages only, so as long as the subject is about this plugin for example, it can be used to try to gain some guidance about how to solve a particular problem.




-- 
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:
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-capture] PabbleDabble edited a comment on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
PabbleDabble edited a comment on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-887480976


   Would it be possible to add search terms / more text to this issue?  I spent the better part of a day tracking down an error that appears to be directly addressed by this PR (thank you by the way!!)
   
   In the 3.0.3 code, within `createMediaFile(Uri data)` after a video capture on Galaxy Tab A7 on Android 11, this line `File fp = webView.getResourceApi().mapUriToFile(data);` yields null (as the uri is NOT in the local system on this device as you noted in your issue).  
   
   Then, later in `createMediaFile(Uri data)` this line is run `LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath());` and since the variable fp is null, you get this error in logcat...
   
   `java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getAbsolutePath()' on a null object reference`
   
   and the plugin crashes, along with our app.  
   
   **Request:** Could some portion of the logcat error be added to the search terms on this page/issue?  Maybe I'm wrong, but this might be a nice way for others who might see this connect that error, with this issue / PR.  
   
   Sorry if this is a dumb question.  Thank you so much again for this PR!!


-- 
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-capture] chriskhongqarma edited a comment on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma edited a comment on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-827026885


   As I explained in this PR,
   `Since the Storage updates 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.`.
   I suggested a solution with this PR and have been waiting for it to be merged. You can pull the code from this PR and try to see if it works. The file recorded should be saved into a path like this:
   `file:///data/user/0/{applicationID}/cache/VID_20210420130001621.avi`


-- 
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:
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-capture] chriskhongqarma commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613967089



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       But I think the app that is used for the automated tests is using the old version. Removing this flag will fail the tests.




-- 
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:
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-capture] chriskhongqarma commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613451543



##########
File path: src/android/Capture.java
##########
@@ -59,7 +59,7 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.net.Uri;
 import android.os.Environment;
 import android.provider.MediaStore;
-import androidx.core.content.FileProvider;

Review comment:
       I tried using androidx, but apparently it is rather troublesome to enable androidx in the media-capture plugin. I think a better solution would be using the old framework like other plugins, and let a cordova plugin called [cordova-plugin-androidx-adapter](https://github.com/dpa99c/cordova-plugin-androidx-adapter) take care of migrating to AndroidX. 




-- 
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:
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744040426



##########
File path: src/android/Capture.java
##########
@@ -399,32 +432,18 @@ public void onImageActivityResult(Request req) {
     }
 
     public void onVideoActivityResult(Request req, Intent intent) {
-        Uri data = null;
-
-        if (intent != null){
-            // Get the uri of the video clip
-            data = intent.getData();
-        }
-
-        if( data == null){
-            File movie = new File(getTempDirectoryPath(), "Capture.avi");
-            data = Uri.fromFile(movie);
-        }
-
-        // create a file object from the uri
-        if(data == null) {
+        if(this.videoAbsolutePath != null) {
+            req.results.put(createMediaFileWithAbsolutePath(this.videoAbsolutePath));
+        } else {
             pendingRequests.resolveWithFailure(req, createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null"));
         }
-        else {
-            req.results.put(createMediaFile(data));
 
-            if (req.results.length() >= req.limit) {
-                // Send Uri back to JavaScript for viewing video
-                pendingRequests.resolveWithSuccess(req);
-            } else {
-                // still need to capture more video clips
-                captureVideo(req);
-            }
+        if (req.results.length() >= req.limit) {
+            // Send Uri back to JavaScript for viewing video
+            pendingRequests.resolveWithSuccess(req);
+        } else {
+            // still need to capture more videos
+            captureVideo(req);
         }
     }
 

Review comment:
       +1 as `createMediaFile(Uri data)` is not used anymore here, fully replaced by `createMediaFileWithAbsolutePath(String path)`




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744046586



##########
File path: src/android/Capture.java
##########
@@ -234,6 +246,17 @@ private void captureAudio(Request req) {
           try {
               Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
+              String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+              String fileName = "AUDIO_" + timeStamp + ".wav";
+              File audio = new File(getTempDirectoryPath(), fileName);

Review comment:
       (for all 3 capture types)
   
   I would drop the use of `getTempDirectoryPath` to not write in app temp dir, because this path is cleaned up by the system while such captured audio/image/video should be available afterward in the device media dirs (correct [Environment.DIRECTORY_..](https://developer.android.com/reference/android/os/Environment#DIRECTORY_PICTURES)) as a common practice.
   
   See the *Taking photos* doc : https://developer.android.com/training/camera/photobasics#TaskPath, really similar to what you have done
   - use `File.createTempFile`
   - with specific values and correct Environment.DIRECTORY_.. for each of our 3 types
   - and possibly more `<external-files-path` entries inside _mediacapture_provider_paths.xml_ to match that




-- 
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-capture] ath0mas commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-962428607


   @chriskhongqarma should be rebased to resolve conflicts since #192 has been merged into _master_ branch yesterday


-- 
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-capture] andreycruz16 edited a comment on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
andreycruz16 edited a comment on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-823067999


   Does this fix this issue?
   I can't play the recorded video on my WebView.
   
   Cordova: 8.1.2
   Cordova-Android: 9.0.0
   cordova-plugin-media-capture: 1.4.3
   
   ![image](https://user-images.githubusercontent.com/11815512/115359650-7827da00-a1f1-11eb-86c7-2727f21e6b30.png)
   


-- 
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:
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-capture] chriskhongqarma commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613849554



##########
File path: src/android/Capture.java
##########
@@ -59,7 +59,7 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.net.Uri;
 import android.os.Environment;
 import android.provider.MediaStore;
-import androidx.core.content.FileProvider;

Review comment:
       I managed to update to using androidx.




-- 
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:
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-capture] chriskhongqarma edited a comment on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma edited a comment on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-827026885


   @mirko77 As I explained in this PR,
   `Since the Storage updates 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.`.
   I suggested a solution with this PR and have been waiting for it to be merged. You can pull the code from this PR and try to see if it works. The file recorded should be saved into a path like this:
   `file:///data/user/0/{applicationID}/cache/VID_20210420130001621.avi`, with `20210420130001621` as the current timestamp. Since it is saved into a FileProvider, your app will have full access to the file.


-- 
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:
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-capture] PabbleDabble commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
PabbleDabble commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r677409238



##########
File path: src/android/Capture.java
##########
@@ -399,32 +432,18 @@ public void onImageActivityResult(Request req) {
     }
 
     public void onVideoActivityResult(Request req, Intent intent) {
-        Uri data = null;
-
-        if (intent != null){
-            // Get the uri of the video clip
-            data = intent.getData();
-        }
-
-        if( data == null){
-            File movie = new File(getTempDirectoryPath(), "Capture.avi");
-            data = Uri.fromFile(movie);
-        }
-
-        // create a file object from the uri
-        if(data == null) {
+        if(this.videoAbsolutePath != null) {
+            req.results.put(createMediaFileWithAbsolutePath(this.videoAbsolutePath));
+        } else {
             pendingRequests.resolveWithFailure(req, createErrorObject(CAPTURE_NO_MEDIA_FILES, "Error: data is null"));
         }
-        else {
-            req.results.put(createMediaFile(data));
 
-            if (req.results.length() >= req.limit) {
-                // Send Uri back to JavaScript for viewing video
-                pendingRequests.resolveWithSuccess(req);
-            } else {
-                // still need to capture more video clips
-                captureVideo(req);
-            }
+        if (req.results.length() >= req.limit) {
+            // Send Uri back to JavaScript for viewing video
+            pendingRequests.resolveWithSuccess(req);
+        } else {
+            // still need to capture more videos
+            captureVideo(req);
         }
     }
 

Review comment:
       @chriskhongqarma Sorry if this is the incorrect place for this comment.




-- 
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-capture] PabbleDabble commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
PabbleDabble commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-887480976


   Would it be possible to add search terms / more text to this issue?  I spent the better part of a day tracking down an error that appears to be directly addressed by this PR (thank you by the way!!)
   
   In the 3.0.3 code, within `createMediaFile(Uri data)` after a video capture on Galaxy Tab A7 on Android 11, this line `File fp = webView.getResourceApi().mapUriToFile(data);` yields null (as the uri is NOT in the local system on this device as you noted in your issue).  
   
   Then, later in `createMediaFile(Uri data)` this line is run `LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath());` and since the variable fp is null, you get this error in logcat...
   
   `java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.getAbsolutePath()' on a null object reference`
   
   and the plugin crashes, along with our app.  
   
   Request: Could some portion of the logcat error be added to the search terms?  Maybe I'm wrong, but this might be a nice way for others who might see this connect that error, with this issue / PR.  
   
   Sorry if this is a dumb question.  Thank you so much again for this PR!!


-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744041027



##########
File path: src/android/Capture.java
##########
@@ -488,6 +507,62 @@ private JSONObject createMediaFile(Uri data) {
         return obj;
     }
 
+    /**
+     * Creates a JSONObject that represents a File from the Uri

Review comment:
       `from the absolute path`




-- 
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-capture] breautek commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
breautek commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745807063



##########
File path: src/android/Capture.java
##########
@@ -301,6 +328,16 @@ private void captureVideo(Request req) {
             PermissionHelper.requestPermission(this, req.requestCode, Manifest.permission.CAMERA);
         } else {
             Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
+            String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+            String fileName = "VID_" + timeStamp + ".avi";

Review comment:
       Ah, well if the docs shows an assumption of `.mp4` I guess it's fine to assume!




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745027587



##########
File path: src/android/Capture.java
##########
@@ -234,6 +246,17 @@ private void captureAudio(Request req) {
           try {
               Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
+              String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+              String fileName = "AUDIO_" + timeStamp + ".wav";
+              File audio = new File(getTempDirectoryPath(), fileName);
+
+              Uri audioUri = FileProvider.getUriForFile(this.cordova.getActivity(),
+                      this.applicationId + ".cordova.plugin.mediacapture.provider",
+                      audio);
+              this.audioAbsolutePath = audio.getAbsolutePath();
+              intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, audioUri);
+              intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);

Review comment:
       why this `intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);`?
   
   - the Android training https://developer.android.com/training/camera/photobasics#TaskPath does not have this line
   - seems to run fine without it in my test app




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745145397



##########
File path: src/android/Capture.java
##########
@@ -234,6 +246,17 @@ private void captureAudio(Request req) {
           try {
               Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
+              String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+              String fileName = "AUDIO_" + timeStamp + ".wav";
+              File audio = new File(getTempDirectoryPath(), fileName);

Review comment:
       https://developer.android.com/guide/topics/media/camera.html#saving-media
   gives example of `mediaStorageDir` defined using `Environment.getExternalStoragePublicDirectory`
   
   but [deprecated](https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String)) since API 29: what to use? are this [SO](https://stackoverflow.com/questions/57116335/environment-getexternalstoragedirectory-deprecated-in-api-level-29-java) or other correct? with pre and post Android Q code? through ContentResolver? through ACTION_CREATE_DOCUMENT? ...




-- 
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-capture] chriskhongqarma edited a comment on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma edited a comment on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-827026885


   As I explained in this PR,
   `Since the Storage updates 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.`.
   I suggested a solution with this PR and have been waiting for it to be merged. You can pull the code from this PR and try to see if it works. The file recorded should be saved into a path like this:
   `file:///data/user/0/{applicationID}/cache/VID_20210420130001621.avi`, with `20210420130001621` as the current timestamp.


-- 
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:
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-capture] breautek commented on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
breautek commented on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-827040470


   > I suggested a solution with this PR and have been waiting for it to be merged.
   
   Just FYI: this PR isn't being ignored, just busy preparing `cordova-android@10` for API 30 support. I'm personally spending time on weekends trying to get `cordova-plugin-file` working with raw file paths (so usage stays pretty much the same). Then I'll be focusing on the media/media-capture plugins.
   
   It's my goal to have all of these plugins ready to be released at the same time, or shortly after `cordova-android@10` is released... (But I can't make any promises...)


-- 
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:
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744046586



##########
File path: src/android/Capture.java
##########
@@ -234,6 +246,17 @@ private void captureAudio(Request req) {
           try {
               Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
+              String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+              String fileName = "AUDIO_" + timeStamp + ".wav";
+              File audio = new File(getTempDirectoryPath(), fileName);

Review comment:
       (for all 3 capture types)
   
   I would drop the use of `getTempDirectoryPath` to not write in app temp dir, because this path is cleaned up by the system while such captured audio/image/video should be available afterward in the device media dirs (correct [Environment.DIRECTORY_..](https://developer.android.com/reference/android/os/Environment#DIRECTORY_PICTURES)) as a common practice.
   
   See the *Taking photos* doc : https://developer.android.com/training/camera/photobasics#TaskPath, really similar to what you have done
   - can there be 3 isolated methods like the suggested `createImageFile()`? and not inlined like here
   - use `File.createTempFile`
   - with specific values and correct Environment.DIRECTORY_.. for each of our 3 types
   - and possibly more `<external-files-path` entries to match that




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r744046586



##########
File path: src/android/Capture.java
##########
@@ -234,6 +246,17 @@ private void captureAudio(Request req) {
           try {
               Intent intent = new Intent(android.provider.MediaStore.Audio.Media.RECORD_SOUND_ACTION);
 
+              String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+              String fileName = "AUDIO_" + timeStamp + ".wav";
+              File audio = new File(getTempDirectoryPath(), fileName);

Review comment:
       (for all 3 capture types)
   
   I would drop the use of `getTempDirectoryPath` to not write in app temp dir, because this path is cleaned up by the system while such captured audio/image/video should be available afterward in the device media dirs (correct [Environment.DIRECTORY_..](https://developer.android.com/reference/android/os/Environment#DIRECTORY_PICTURES)) as a common practice.
   
   See https://developer.android.com/training/camera/photobasics#TaskPath
   - can there be 3 isolated methods like the suggested `createImageFile()`? and not inlined like here
   - use `File.createTempFile`
   - with specific values and correct Environment.DIRECTORY_.. for each of our 3 types
   - and possibly more `<external-files-path` entries to match that




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745036608



##########
File path: src/android/Capture.java
##########
@@ -369,10 +406,8 @@ else if (resultCode == Activity.RESULT_CANCELED) {
 
 
     public void onAudioActivityResult(Request req, Intent intent) {

Review comment:
       can remove the `Intent intent` for the 3 `onAudio/Image/VideoActivityResult` not used anymore




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745128738



##########
File path: src/android/Capture.java
##########
@@ -301,6 +328,16 @@ private void captureVideo(Request req) {
             PermissionHelper.requestPermission(this, req.requestCode, Manifest.permission.CAMERA);
         } else {
             Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
+            String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+            String fileName = "VID_" + timeStamp + ".avi";

Review comment:
       @breautek I think you're right :/
   
   "but" one more link in Android training docs should be interesting to follow : https://developer.android.com/guide/topics/media/camera.html#saving-media
   for its `getOutputMediaFile()`, with output switch for MEDIA_TYPE_IMAGE or MEDIA_TYPE_VIDEO = "IMG_*.jpg" // "VID_*.mp4"
   
   a similar output extension of `.mp4` can be found in CameraX training too




-- 
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-capture] ath0mas commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
ath0mas commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r745036608



##########
File path: src/android/Capture.java
##########
@@ -369,10 +406,8 @@ else if (resultCode == Activity.RESULT_CANCELED) {
 
 
     public void onAudioActivityResult(Request req, Intent intent) {

Review comment:
       can remove the `Intent intent` param for the 3 `onAudio/Image/VideoActivityResult` not used anymore




-- 
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-capture] chriskhongqarma edited a comment on pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
chriskhongqarma edited a comment on pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#issuecomment-827026885


   As I explained in this PR,
   `Since the Storage updates 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.`.
   I suggested a solution with this PR and have been waiting for it to be merged. You can pull the code from this PR and try to see if it works. The file recorded should be saved into a path like this:
   `file:///data/user/0/{applicationID}/cache/VID_20210420130001621.avi`, with `20210420130001621` as the current timestamp. Since it is saved into a FileProvider, your app will have full access to the file.


-- 
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:
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-capture] breautek commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
breautek commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613227436



##########
File path: src/android/FileProvider.java
##########
@@ -18,4 +18,4 @@ Licensed to the Apache Software Foundation (ASF) under one
 */
 package org.apache.cordova.mediacapture;
 
-public class FileProvider extends androidx.core.content.FileProvider {}

Review comment:
       Same as above

##########
File path: src/android/Capture.java
##########
@@ -59,7 +59,7 @@ Licensed to the Apache Software Foundation (ASF) under one
 import android.net.Uri;
 import android.os.Environment;
 import android.provider.MediaStore;
-import androidx.core.content.FileProvider;

Review comment:
       Our next major version of cordova-android will force using AndroidX, so it's probably best if we stick with androidx here.
   
   Cordova-android@9 supports `AndroidX` via the `AndroidXEnabled` preference.




-- 
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:
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-capture] breautek commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
breautek commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613998625



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       > But I think the app that is used for the automated tests is using the old version. Removing this flag will fail the tests.
   
   I think we can leave this in for now just for the sake of using the automated tests. Once `cordova-android@10` is released, it can be removed, as the automated tests will start using `cordova-android@10`, which should work without adding this preference.
   
   We'll need to also update the engines on this plugin so that older versions of plugin cannot be used on `cordova-android@`10`, and version 4 of this plugin is required if using `cordova-android@10`, but this can be done as a separate independent PR.




-- 
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:
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-capture] erisu commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
erisu commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r613962997



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       This preference is being removed in the next release of Cordova Android.
   
   As this PR is implementing with Android X, it will have to be released in next major of this plugin and flagged for next major of Android.
   
   This can be removed...




-- 
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:
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-capture] erisu commented on a change in pull request #215: [Android] Store image/audio/video in FileProvider due to Android 11 updates

Posted by GitBox <gi...@apache.org>.
erisu commented on a change in pull request #215:
URL: https://github.com/apache/cordova-plugin-media-capture/pull/215#discussion_r614048383



##########
File path: plugin.xml
##########
@@ -71,6 +71,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
     <!-- android -->
     <platform name="android">
         <config-file target="res/xml/config.xml" parent="/*">
+            <preference name="AndroidXEnabled" value="true" />

Review comment:
       This type of PR can not be merged in until after Cordova Android 10 is released because of the hard requirement to use AndroidX library.
   
   If you want this merged into the main branch and able to use it with the current Cordova Android 9.x release, you will need to remove all of the AndroidX requirements and go back to the ASL.




-- 
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:
users@infra.apache.org



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